planetj.dataengine.display
Class ReflectAction

java.lang.Object
  |
  +--planetj.dataengine.display.AbstractAction
        |
        +--planetj.dataengine.display.ReflectAction
Direct Known Subclasses:
ReflectRowAction, ReflectRowCollectionAction

public class ReflectAction
extends AbstractAction

A ReflectAction uses java reflection to invoke a method on a given Object.

Author:
PlanetJ Corporation

Field Summary
 
Fields inherited from class planetj.dataengine.display.AbstractAction
DEFAULT_TYPE
 
Constructor Summary
ReflectAction(Class c, String methodName)
          ReflectAction constructor.
ReflectAction(Class c, String methodName, Class[] parameterTypes)
          ReflectMethodRowAction constructor.
ReflectAction(String methodName)
          ReflectMethodRowAction constructor.
ReflectAction(String methodName, Class[] parameterTypes)
          ReflectMethodRowAction constructor.
 
Method Summary
 Class getMethodClass()
          Gets the Class containing the method to reflect.
 String getMethodName()
          Gets the name of the method this action should reflect on a given Row.
 Class[] getParameterTypes()
          Gets the parameter types classes to use when reflecting on a Row's method..
 Object handleAction(Object o)
          Refects this action's method on the given object.
 Object handleAction(Object o, Object[] args)
          Uses java reflection to invoke this action's method on the given Object.
 void setMethodClass(Class c)
          Sets the Class contianing the method to reflect.
 void setMethodName(String methodName)
          Sets the name of the method this action should reflect on a given Row.
 void setParameterTypes(Class[] parameterTypes)
          Sets the parameter types the method this action should use when reflecting on a given Row.
 
Methods inherited from class planetj.dataengine.display.AbstractAction
getType
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectAction

public ReflectAction(Class c,
                     String methodName)
ReflectAction constructor.

Parameters:
c - class containing method
methodName - name of method to reflect

ReflectAction

public ReflectAction(Class c,
                     String methodName,
                     Class[] parameterTypes)
ReflectMethodRowAction constructor.

Parameters:
c - class containing method
methodName - name of method to reflect on the Row
parameterTypes - array of class types for method parameters

ReflectAction

public ReflectAction(String methodName)
ReflectMethodRowAction constructor.

Parameters:
methodName - name of method to reflect on the Row

ReflectAction

public ReflectAction(String methodName,
                     Class[] parameterTypes)
ReflectMethodRowAction constructor.

Parameters:
methodName - name of method to reflect on the Row
Method Detail

getMethodClass

public Class getMethodClass()
Gets the Class containing the method to reflect.

Returns:
class contianing method

getMethodName

public String getMethodName()
Gets the name of the method this action should reflect on a given Row.

Returns:
name of method to reflect on Row.

getParameterTypes

public Class[] getParameterTypes()
Gets the parameter types classes to use when reflecting on a Row's method..

Returns:
parameter types.

handleAction

public Object handleAction(Object o)
                    throws InvocationTargetException
Refects this action's method on the given object. If the method to be used for reflection requires parameters, then handleAction(Object, Object[]) should be used.

Specified by:
handleAction in class AbstractAction
Parameters:
o - Object to perform the action on
InvocationTargetException

handleAction

public Object handleAction(Object o,
                           Object[] args)
                    throws InvocationTargetException
Uses java reflection to invoke this action's method on the given Object. No Object is required if invoking a static method on an Object, provided a Class was specified during this action's instance creation.

Parameters:
o - Object to reflect method on
InvocationTargetException

setMethodClass

public void setMethodClass(Class c)
Sets the Class contianing the method to reflect.


setMethodName

public void setMethodName(String methodName)
Sets the name of the method this action should reflect on a given Row.

Parameters:
methodName - name of method to reflect on Row.

setParameterTypes

public void setParameterTypes(Class[] parameterTypes)
Sets the parameter types the method this action should use when reflecting on a given Row.

Parameters:
parameterTypes - array of classes for method.