net.christopherschultz.evaluator.function
Class IJWInvocation

java.lang.Object
  extended by net.christopherschultz.evaluator.StandardFunction
      extended by net.christopherschultz.evaluator.function.IJWInvocation
All Implemented Interfaces:
Function
Direct Known Subclasses:
CallFunction

public class IJWInvocation
extends StandardFunction

Calls a method matching the function's name on the first argument, passing the remaining function arguments as arguments to the object method.

The .NET framework calls this "It Just Works", or IJW, which is where I took this name.

Here's an example of how this works. If you expression is

substring("hello world", 1, 4)

Then by using an IJWInvocation function call, the "hello world" String object will be used to call the "substring" method with the remaining arguments (1 and 4).

Version:
$Revision: 1.5 $ $Date: 2008-06-20 22:58:48 $
Author:
Chris Schultz

Constructor Summary
IJWInvocation()
          Creates a new IJWInvocation object.
 
Method Summary
 Object call(EvaluationContext ec, String functionName, Object[] arguments)
          Calls this function with standard argument evaluation semantics.
 
Methods inherited from class net.christopherschultz.evaluator.StandardFunction
call, getExpressionValue, getExpressionValueArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IJWInvocation

public IJWInvocation()
Creates a new IJWInvocation object.

Method Detail

call

public Object call(EvaluationContext ec,
                   String functionName,
                   Object[] arguments)
            throws EvaluationException
Description copied from class: StandardFunction
Calls this function with standard argument evaluation semantics.

Specified by:
call in class StandardFunction
Parameters:
ec - The EvaluationContext in which this function is being called.
functionName - The name of the function being invoked.
arguments - The argument values to pass to this function.
Returns:
The result of the function.
Throws:
EvaluationException - If there is an error during function execution.