org.onemind.commons.invoke
Class ReflectionWrapperInvocable

java.lang.Object
  extended byorg.onemind.commons.invoke.AbstractInvocable
      extended byorg.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
ReflectionWrapperInvocable(java.lang.Object obj)
          Constructor
ReflectionWrapperInvocable(java.lang.Object obj, boolean useReflect)
          Constructor
 
Method Summary
 boolean canInvoke(java.lang.String functionName, java.lang.Object[] args)
          whether the function can be invoke with the arguments
 InvocableFunction getFunction(java.lang.String functionName, java.lang.Object[] args)
          Get the function
 java.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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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 wrappee
useReflect - 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 interface Invocable
Overrides:
canInvoke in class AbstractInvocable

getFunction

public InvocableFunction getFunction(java.lang.String functionName,
                                     java.lang.Object[] args)
Get the function

Specified by:
getFunction in interface Invocable
Overrides:
getFunction in class AbstractInvocable

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 interface Invocable
Overrides:
invoke in class AbstractInvocable
Throws:
java.lang.Exception


Copyright © 2004-2005 . All Rights Reserved.