package coin.optargs;

import java.lang.reflect.Method;

public class Reflect {
	
	public static boolean isOptArgs(Method method) {
		Class<?>[] types = method.getParameterTypes();
		return types.length>0 && types[types.length-1]==OptArgs.class
			&& method.isAnnotationPresent(OptArgsInfo.class);
	}
	
	public static OptArg[] getOptArgs(Method method) {
		return method.getAnnotation(OptArgsInfo.class).value();
	}
	
	public static boolean isOptArgsAcceptUnknownArgs(Method method) {
		return method.getAnnotation(OptArgsInfo.class).acceptUnknownArgs();
	}
}
