Package org.onemind.commons.invoke
Class ReflectionWrapperInvocable
- java.lang.Object
-
- org.onemind.commons.invoke.AbstractInvocable
-
- org.onemind.commons.invoke.ReflectionWrapperInvocable
-
- All Implemented Interfaces:
Invocable
public class ReflectionWrapperInvocable extends AbstractInvocable
An wrapper invocable that will use reflection to optionally use reflection for invocation if possible- Version:
- $Id: ReflectionWrapperInvocable.java,v 1.4 2005/01/24 05:52:21 thlee Exp $ $Name: $
- Author:
- TiongHiang Lee (thlee@onemindsoft.org)
-
-
Constructor Summary
Constructors Constructor Description ReflectionWrapperInvocable(java.lang.Object obj)
ConstructorReflectionWrapperInvocable(java.lang.Object obj, boolean useReflect)
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canInvoke(java.lang.String functionName, java.lang.Object[] args)
whether the function can be invoke with the argumentsInvocableFunction
getFunction(java.lang.String functionName, java.lang.Object[] args)
Get the functionjava.lang.Object
invoke(java.lang.String functionName, java.lang.Object[] args)
invoke the function with the arguments provided-
Methods inherited from class org.onemind.commons.invoke.AbstractInvocable
addFunction, getFunction, getFunctions
-
-
-
-
Constructor Detail
-
ReflectionWrapperInvocable
public ReflectionWrapperInvocable(java.lang.Object obj)
Constructor- Parameters:
obj
- the wrappee
-
ReflectionWrapperInvocable
public ReflectionWrapperInvocable(java.lang.Object obj, boolean useReflect)
Constructor- Parameters:
obj
- the wrappeeuseReflect
- whether to use reflection
-
-
Method Detail
-
canInvoke
public boolean canInvoke(java.lang.String functionName, java.lang.Object[] args)
whether the function can be invoke with the arguments- Specified by:
canInvoke
in interfaceInvocable
- Overrides:
canInvoke
in classAbstractInvocable
- Parameters:
functionName
- the function nameargs
- the arguments- Returns:
- true if can invoke
-
getFunction
public InvocableFunction getFunction(java.lang.String functionName, java.lang.Object[] args)
Get the function- Specified by:
getFunction
in interfaceInvocable
- Overrides:
getFunction
in classAbstractInvocable
- Parameters:
functionName
- the function nameargs
- the arguments- Returns:
- the function, or null if the function cannot be found
-
invoke
public java.lang.Object invoke(java.lang.String functionName, java.lang.Object[] args) throws java.lang.Exception
invoke the function with the arguments provided- Specified by:
invoke
in interfaceInvocable
- Overrides:
invoke
in classAbstractInvocable
- Parameters:
functionName
- the function nameargs
- the arguments- Returns:
- the object returns from the invocation
- Throws:
java.lang.Exception
- if there's problem invoking the function
-
-