public class BSHMethod
extends java.lang.Object
| Constructor and Description |
|---|
BSHMethod(java.lang.String bshData,
boolean source)
Creates a BSHMethod.
|
| Modifier and Type | Method and Description |
|---|---|
static BSHMethod |
createBshMethod(org.jdom2.Element e)
Creates a BSHMethod from a JDom Element.
|
java.util.Map |
execute(java.util.Map arguments,
java.util.Collection returnNames)
Sets the given arguments to the Interpreter, evaluates the script and
returns a map that has the Strings of the returnNames collection as keys
and the objects stored in the variables thus named as values.
|
java.lang.Object |
execute(java.util.Map arguments,
java.lang.String resultName)
Sets the given arguments to the Interpreter, evaluates the script and
returns the object stored on the variable named resultName.
|
protected bsh.Interpreter |
initInterpreter(java.util.Map arguments) |
java.lang.String |
toString() |
public BSHMethod(java.lang.String bshData,
boolean source)
bshData - - May either be the file to source or the script itself to
evaluate.source - - If true indicates that the bshData passed is a file to
source. Otherwise the string itself is evaluated.public static BSHMethod createBshMethod(org.jdom2.Element e) throws java.io.IOException
Example 1 :
<prepare>
import org.jpos.iso.*;
import org.jpos.transaction.*;
msg = context.get("txnRequest");
BaseChannel.getChannel("loop-channel").send(msg);
result=TransactionConstants.PREPARED | TransactionConstants.READONLY;
</prepare>
Example 2 :
<routing file='cfg\files\routing1.bsh' cache='false'/>
java.io.IOExceptionpublic java.lang.Object execute(java.util.Map arguments,
java.lang.String resultName)
throws bsh.EvalError,
java.io.IOException
arguments - Parameters to set to the Interpreter. For every
Map.Entry (key, value), interpreter.set(key, value)
is called. All keys must be Strings.bsh.EvalErrorjava.io.IOExceptionpublic java.util.Map execute(java.util.Map arguments,
java.util.Collection returnNames)
throws bsh.EvalError,
java.io.IOException
arguments - Parameters to set to the Interpreter. For every
Map.Entry (key, value), interpreter.set(key, value)
is called. All keys must be Strings.returnNames - Collection of Strings. The names of the variables
wich`s contents are to be returned.bsh.EvalErrorjava.io.IOExceptionprotected bsh.Interpreter initInterpreter(java.util.Map arguments)
throws bsh.EvalError,
java.io.IOException
bsh.EvalErrorjava.io.IOExceptionpublic java.lang.String toString()
toString in class java.lang.Object