Package edu.uiuc.ncsa.security.util.cli
Class CLIReflectionUtil
- java.lang.Object
-
- edu.uiuc.ncsa.security.util.cli.CLIReflectionUtil
-
public class CLIReflectionUtil extends Object
Created by Jeff Gaynor
on 5/21/13 at 2:28 PM
-
-
Constructor Summary
Constructors Constructor Description CLIReflectionUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String[]getCommandsNameList(Commands[] commands)This snoops through the CCI and gets those methods that are not in Java.lang.Object, are public and are not static.static booleanhasRightSignature(Method method)Checks that the method has the correct signature for the contract in the Commands interface, i.e.static voidinvokeMethod(Commands obj, String name, InputLine cliAV)Invokes the named method on the object.static booleanisJavaObjectMethod(String methodName, int mods)Returns true if the methodName is one of the java.lang.Object basic methods (e.g.
-
-
-
Method Detail
-
isJavaObjectMethod
public static boolean isJavaObjectMethod(String methodName, int mods)
Returns true if the methodName is one of the java.lang.Object basic methods (e.g. toString()).- Parameters:
methodName-mods-- Returns:
-
invokeMethod
public static void invokeMethod(Commands obj, String name, InputLine cliAV) throws NoSuchMethodException, InvocationTargetException, IllegalAccessException
Invokes the named method on the object. This assumes that the object is an implementation of theCommandsinterface.- Parameters:
obj-name-cliAV-- Throws:
NoSuchMethodExceptionInvocationTargetExceptionIllegalAccessException
-
getCommandsNameList
public static String[] getCommandsNameList(Commands[] commands)
This snoops through the CCI and gets those methods that are not in Java.lang.Object, are public and are not static. Note that this will return all the unique names in the commands array. This method is not tasked with dis-ambiguating them.- Returns:
- java.lang.String[]
-
hasRightSignature
public static boolean hasRightSignature(Method method)
Checks that the method has the correct signature for the contract in the Commands interface, i.e. that takes a single InputLine as it argument, is public and not static.- Parameters:
method-- Returns:
-
-