org.pietschy.command
Class ReflectionCommand
- ActionCommandExecutor
public class ReflectionCommand
The ReflectionCommand invokes a target method using reflection.
ReflectionCommand(String commandId, Class clazz, String methodName) - Creates a new reflection command that invokess a static no arg method.
|
ReflectionCommand(String commandId, Class clazz, String methodName, Class[] methodArgs) - Creates a new reflection command that invokes a static class method with arguments.
|
ReflectionCommand(String commandId, Object instance, String methodName) - Creates a new reflection command that invokes a non static method on the specified object.
|
ReflectionCommand(String commandId, Object instance, String methodName, Class[] methodArgs)
|
ReflectionCommand(String commandId, String className, String methodName) - Creates a new reflection command that invokes a static no arg method.
|
protected Object[] | getInvocationArgs() - Gets any arguments required by the delegate.
|
protected void | handleExecute() - Main entry point for command subclasses that must be implemented to provide
command specific behaviour.
|
protected void | handleInvocationException(Exception e) - Called to handle any exceptions that occur during the invocation of the delegate method.
|
addCommandListener , addInterceptor , areEqual , attach , configureButtonStates , detach , execute , execute , getActionAdapter , getActionAdapter , getActionCommand , getActionEvent , getHint , getHint , getHints , getInvoker , getInvokerWindow , getModifiers , handleExecute , installShortCut , installShortCut , postExecute , preExecute , putHint , putHints , removeCommandListener , removeInterceptor , requestDefautIn , setActionCommand , uninstallShortCut , uninstallShortCut |
addFace , addHoverListener , addNewFace , addNotify , addPropertyChangeListener , addPropertyChangeListener , attach , buttonIterator , configureButtonAppearance , configureButtonAppearances , configureButtonAppearances , configureButtonStates , createButton , createButton , createButton , createButton , createMenuItem , createMenuItem , createMenuItem , createMenuItem , detach , export , faceExists , fireHoverEnded , fireHoverStarted , getAccelerator , getAlternativeFaceNames , getButtonFactory , getButtonIn , getCommandManager , getDefaultFace , getDefaultFace , getDescription , getFace , getFace , getIcon , getId , getLongDescription , getMenuFactory , getMnemonic , getMnemonicIndex , getProperty , getProperty , getPropertyNames , getSelectedIcon , getText , getTextPosition , getToolbarFactory , initCommandManager , installFace , isAnonymous , isAttachedTo , isEnabled , isVisible , putProperty , removeHoverListener , removeNotify , removePropertyChangeListener , removePropertyChangeListener , requestFocusIn , setAccelerator , setButtonFactory , setDescription , setEnabled , setIcon , setLongDescription , setMenuFactory , setMnemonic , setMnemonicIndex , setSelectedIcon , setText , setTextPosition , setToolbarFactory , setVisible , toString |
ReflectionCommand
public ReflectionCommand(String commandId,
Class clazz,
String methodName)
throws NoSuchMethodException
Creates a new reflection command that invokess a static no arg method.
commandId
- the id of the command.clazz
- the class on which the static method residesmethodName
- the name of the no arg static method.
ReflectionCommand
public ReflectionCommand(String commandId,
Class clazz,
String methodName,
Class[] methodArgs)
throws NoSuchMethodException
Creates a new reflection command that invokes a static class method with arguments.
commandId
- the id of the command.clazz
- the class on which the static method resides.methodName
- the method name.methodArgs
- the arguments of the method. This may be null if the argument takes
no methods. If arguments are specified, the getInvocationArgs()
method must be
implemented to provide the arguments to the method invocation.
ReflectionCommand
public ReflectionCommand(String commandId,
Object instance,
String methodName)
throws NoSuchMethodException
Creates a new reflection command that invokes a non static method on the specified object.
commandId
- the id of the commandinstance
- that target instance on which the method will be invoked.methodName
- the name of the method to invoke.
ReflectionCommand
public ReflectionCommand(String commandId,
Object instance,
String methodName,
Class[] methodArgs)
throws NoSuchMethodException
commandId
- instance
- methodName
- methodArgs
- the arguments of the method. This may be null if the argument takes
no methods. If arguments are specified, the getInvocationArgs()
method must be
implemented to provide the arguments to the method invocation.
ReflectionCommand
public ReflectionCommand(String commandId,
String className,
String methodName)
throws NoSuchMethodException,
ClassNotFoundException
Creates a new reflection command that invokes a static no arg method. This constructor uses
it's own classloader that loaded the target class.
commandId
- the id of the command.className
- the class on which the static method residesmethodName
- the name of the no arg static method.
getInvocationArgs
protected Object[] getInvocationArgs()
Gets any arguments required by the delegate. The default implementation returns
null, subclass should override as required.
- the arguments required for the method delegate. Returns null by default.
handleInvocationException
protected void handleInvocationException(Exception e)
Called to handle any exceptions that occur during the invocation of the delegate method.
e
- the exception that occured while calling method.invoke(..)