public class Java extends java.lang.Object implements ObjectHandler
Note that since Java must be compiled before running, this object macro language is only
available at compile-time using the RiveScript.setSubroutine(String, Subroutine)
method.
Inline Java code can't be parsed and compiled from RiveScript source files.
ObjectHandler
Constructor and Description |
---|
Java(RiveScript rs)
Constructs a Java
ObjectHandler . |
Modifier and Type | Method and Description |
---|---|
java.lang.String |
call(java.lang.String name,
java.lang.String[] fields)
Handler for when a user invokes the object.
|
void |
load(java.lang.String name,
java.lang.String[] code)
Handler for when object code is read (loaded) by RiveScript.
|
public Java(RiveScript rs)
ObjectHandler
.rs
- The RiveScript instance, not null.public void load(java.lang.String name, java.lang.String[] code)
load
in interface ObjectHandler
name
- the name of the objectcode
- the source code inside the objectpublic java.lang.String call(java.lang.String name, java.lang.String[] fields)
String
result from the object.
This code is executed when a <call>
tag in a RiveScript reply wants to call your object macro.
call
in interface ObjectHandler
name
- the name of the object being calledfields
- the argument list from the call tag