Package org.onemind.commons.invoke
Class AbstractInvocable
- java.lang.Object
-
- org.onemind.commons.invoke.AbstractInvocable
-
- All Implemented Interfaces:
Invocable
- Direct Known Subclasses:
ReflectionWrapperInvocable
public abstract class AbstractInvocable extends java.lang.Object implements Invocable
An invocable that contain a list of invocable functions to be invoke upon. In current implementation, it can only contains on function with the specific name (regardless of arg types) TODO: improve to allow multiple functions with same name (different args)- Version:
- $Id: AbstractInvocable.java,v 1.1 2005/01/24 05:51:36 thlee Exp $ $Name: $
- Author:
- TiongHiang Lee (thlee@onemindsoft.org)
-
-
Constructor Summary
Constructors Constructor Description AbstractInvocable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addFunction(InvocableFunction function)
Add an functionboolean
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.Class[] argTypes)
InvocableFunction
getFunction(java.lang.String functionName, java.lang.Object[] args)
Get the functionjava.util.Collection
getFunctions()
Get all the functionsjava.lang.Object
invoke(java.lang.String functionName, java.lang.Object[] args)
invoke the function with the arguments provided
-
-
-
Method Detail
-
addFunction
public void addFunction(InvocableFunction function)
Add an function- Parameters:
functionName
- the function namefunction
- the function
-
getFunction
public InvocableFunction getFunction(java.lang.String functionName, java.lang.Object[] args)
Get the function- Specified by:
getFunction
in interfaceInvocable
- Parameters:
functionName
- the function nameargs
- the arguments- Returns:
- the function, or null if the function cannot be found
-
getFunction
public InvocableFunction getFunction(java.lang.String functionName, java.lang.Class[] argTypes)
-
canInvoke
public boolean canInvoke(java.lang.String functionName, java.lang.Object[] args)
whether the function can be invoke with the arguments
-
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
-
getFunctions
public java.util.Collection getFunctions()
Get all the functions- Returns:
- the functions
-
-