org.apache.commons.pipeline.stage
Class InvokeStaticMethodStage

java.lang.Object
  extended by org.apache.commons.pipeline.stage.BaseStage
      extended by org.apache.commons.pipeline.stage.InvokeStaticMethodStage
All Implemented Interfaces:
Stage

public class InvokeStaticMethodStage
extends BaseStage

Runs a static method with the object (or array) being processed. The returned object will be exqueued on the main pipeline if it is not null. If the returned object is null, this stage will attempt to place the original object on the branch specified by #setNullResultBranchTag(String).


Field Summary
 
Fields inherited from class org.apache.commons.pipeline.stage.BaseStage
context
 
Constructor Summary
InvokeStaticMethodStage(Method method)
          Creates a new instance of InvokeStaticMethodStage
InvokeStaticMethodStage(String className, String methodName, String... argumentTypeNames)
          Convenience method to create the new stage with String description of className, methodName and argumentType
 
Method Summary
 Method getMethod()
          Returns the Method object for the method that will be used to process objects in the queue.
 String getNullResultBranchKey()
          Getter for property nullResultBranchKey.
 void process(Object obj)
          Calls the defined static method and exqueues the returned object if it is not null, otherwise placing the original object on the branch specified by the nullResultBranchKey property if nullResultBranchKey is not null.
 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

InvokeStaticMethodStage

public InvokeStaticMethodStage(Method method)
Creates a new instance of InvokeStaticMethodStage


InvokeStaticMethodStage

public InvokeStaticMethodStage(String className,
                               String methodName,
                               String... argumentTypeNames)
                        throws ClassNotFoundException,
                               NoSuchMethodException
Convenience method to create the new stage with String description of className, methodName and argumentType

Parameters:
className - The fully qualified class name, such as "java.lang.String" of the class in which the method resides
methodName - The name of the method
argumentType - The argument type of the method (Sorry, this doesn't support multiple argument methods)
Throws:
ClassNotFoundException
NoSuchMethodException
Method Detail

getMethod

public Method getMethod()
Returns the Method object for the method that will be used to process objects in the queue.


process

public void process(Object obj)
             throws StageException

Calls the defined static method and exqueues the returned object if it is not null, otherwise placing the original object on the branch specified by the nullResultBranchKey property if nullResultBranchKey is not null.

Specified by:
process in interface Stage
Overrides:
process in class BaseStage
Parameters:
obj - The object to be processed.
Throws:
StageException - an Exception thrown by an overriding implementation should be wrapped in a StageException

getNullResultBranchKey

public String getNullResultBranchKey()
Getter for property nullResultBranchKey.

Returns:
Value of property nullResultBranchKey.

setNullResultBranchKey

public void setNullResultBranchKey(String nullResultBranchKey)
Setter for property nullResultBranchKey. If set to null (default) then objects generating null results are simply dropped from the stream.

Parameters:
nullResultBranchKey - New value of property nullResultBranchKey.


Copyright © 2004-2009 The Apache Software Foundation. All Rights Reserved.