info.javelot.functionalj
Class StaticFunction

java.lang.Object
  extended byinfo.javelot.functionalj.Function
      extended byinfo.javelot.functionalj.ReflectionFunction
          extended byinfo.javelot.functionalj.MethodFunction
              extended byinfo.javelot.functionalj.StaticFunction
All Implemented Interfaces:
Serializable

public class StaticFunction
extends MethodFunction

Represents a function that targets a static method. See MethodFunction for information on how method names are matched.

Author:
Copyright © 2006 Frederic Daoud
See Also:
Serialized Form

Field Summary
 
Fields inherited from class info.javelot.functionalj.Function
m_class, m_name, m_object, m_parameters, m_targets
 
Constructor Summary
StaticFunction(Class p_class, String p_name)
          Creates a function that targets the static methods of the given class which match the given name.
StaticFunction(Class p_class, String p_name, Object[] p_parameters)
          Creates a function that targets the static methods of the given class which match the given name, with the supplied parameters.
 
Method Summary
 boolean isObjectRequired()
          Returns false since an object is not required to invoke the method.
protected  Function newInstance(Class p_class, Object[] p_parameters)
          Creates a new StaticFunction object using the specified target class and parameters.
 Function object(Object p_object)
          Throws a FunctionException, since no object is required to invoke a static method.
 
Methods inherited from class info.javelot.functionalj.MethodFunction
getAllTargets, getInsertIndex, getParameterTypes, invoke
 
Methods inherited from class info.javelot.functionalj.ReflectionFunction
call
 
Methods inherited from class info.javelot.functionalj.Function
addParameter, addParameters, addParameters, addParameters, addParameters, addParameters, getName, getObject, getParameters, getTargetClass, getTargets, isObjectPresent, objectOrParameter, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StaticFunction

public StaticFunction(Class p_class,
                      String p_name)
Creates a function that targets the static methods of the given class which match the given name. See StaticFunction(Class,String,Object[]) for more details.

See Also:
StaticFunction(Class,String,Object[])

StaticFunction

public StaticFunction(Class p_class,
                      String p_name,
                      Object[] p_parameters)
Creates a function that targets the static methods of the given class which match the given name, with the supplied parameters.

Parameters:
p_class - the class of the target.
p_name - the name to match, either exactly or by interpreting the name as a property and matching on the corresponding getter and setter methods.
p_parameters - the parameters to be supplied to the method.
Throws:
FunctionException - thrown if no methods of the target class match the given name.
Method Detail

isObjectRequired

public boolean isObjectRequired()
Returns false since an object is not required to invoke the method.

Specified by:
isObjectRequired in class Function
Returns:
false.

newInstance

protected Function newInstance(Class p_class,
                               Object[] p_parameters)
Creates a new StaticFunction object using the specified target class and parameters.

Specified by:
newInstance in class Function
Parameters:
p_class - the class of the target.
p_parameters - the supplied parameters.
Returns:
a new StaticFunction object of the target class, containing the supplied parameters.

object

public Function object(Object p_object)
                throws FunctionException
Throws a FunctionException, since no object is required to invoke a static method.

Specified by:
object in class Function
Throws:
FunctionException - always thrown since invoking this method is not applicable to instances of the StaticFunction class.