|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.commons.pipeline.stage.BaseStage org.apache.commons.pipeline.stage.DynamicLookupStaticMethodStage
public class DynamicLookupStaticMethodStage
Provide this Stage with a class and a static method name and it will dynamically look up the appropriate method to call based on the object type. If the object type is an array, it will assume that the method that needs to be called contains the method signature as described by the objects in the array. The object returned from the method call will be exqueued.
The resulting object will be exqueued on the main pipeline if it is not null. If it is null, we will try to place the original object on the branch specified by the nullResultBranchKey property. The default for this value is "nullResult".
Field Summary |
---|
Fields inherited from class org.apache.commons.pipeline.stage.BaseStage |
---|
context |
Constructor Summary | |
---|---|
DynamicLookupStaticMethodStage(Class clazz,
String methodName)
Creates a new instance of DynamicLookupStaticMethodStage |
|
DynamicLookupStaticMethodStage(String className,
String methodName)
Creates a new DynamicLookupStaticMethodStage for the specified class and static method. |
Method Summary | |
---|---|
Class |
getMethodClass()
Returns the class containing the method to be executed |
String |
getMethodName()
Returns the name of the method to be executed. |
String |
getNullResultBranchKey()
Getter for property nullResultBranchKey. |
void |
process(Object obj)
Finds the appropriate method overloading for the method specified by methodName , calls it to process the object, and
exqueues any returned object. |
void |
setNullResultBranchKey(String nullResultBranchKey)
Setter for property nullResultBranchKey. |
Methods inherited from class org.apache.commons.pipeline.stage.BaseStage |
---|
emit, emit, init, postprocess, preprocess, release |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DynamicLookupStaticMethodStage(Class clazz, String methodName)
clazz
- The class that defines the static method that will be used to
process objects.methodName
- The name of the method. This method may be overloaded.public DynamicLookupStaticMethodStage(String className, String methodName) throws ClassNotFoundException
className
- The fully qualified class name of the class in which the
static method that will be used to process objects is defined.methodName
- The name of the method. This method may be overloaded.
ClassNotFoundException
- if the specified class cannot be loaded.Method Detail |
---|
public void process(Object obj) throws StageException
Finds the appropriate method overloading for the method specified by
methodName
, calls it to process the object, and
exqueues any returned object. If the returned object is null, the
original object is enqueued on the branch specified by the
nullResultBranchKey property.
process
in interface Stage
process
in class BaseStage
obj
- The object to process.
StageException
- an Exception thrown by an overriding implementation should
be wrapped in a StageException
public String getMethodName()
public Class getMethodClass()
public String getNullResultBranchKey()
public void setNullResultBranchKey(String nullResultBranchKey)
nullResultBranchKey
- New value of property nullResultBranchKey.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |