public class LocalSession extends DSession
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the session.
|
java.lang.Object |
evaluate(java.lang.String expr)
Evaluates a Duro D/T expression.
|
<T> T |
evaluate(java.lang.String expr,
java.lang.Class<T> destClass)
Evaluates expr, stores the result in an instance of class
destClass
and returns that instance. |
void |
evaluate(java.lang.String expr,
java.lang.Object dest)
Evaluates the expression
expr and stores the
value in dest . |
void |
execute(java.lang.String code)
Executes Duro D/T code.
|
void |
setVar(java.lang.String name,
java.lang.Object v)
Assigns a value to a variable.
|
createSession, createSession
public void close()
close
in class DSession
DException
- If a Duro error occurspublic void execute(java.lang.String code)
DSession
User-defined operators implemented in Java can be created by using the OPERATOR statement with the EXTERN keyword.
Creating a user-defined read-only operator implemented by a Java method:
OPERATOR <opname>(<parameter_list>) RETURNS <type>
EXTERN 'Java' '<classname>.<methodname>';
END OPERATOR;
The method must be static. Parameter types and return type map to Java
types as described in evaluate
.
Creating a user-defined update operator implemented by a Java method:
OPERATOR <opname>(<parameter_list>) UPDATES { <update_param_list> }
EXTERN 'Java' '<classname>.<methodname>';
END OPERATOR;
The method must be static. Non-update parameter types map to Java types
as described in evaluate
.
Update parameter types map to Java classes as follows:
boolean
UpdatableBoolean
string
integer
UpdatableInteger
float
UpdatableDouble
binary
ByteArray
tuple { ... }
Tuple
relation { ... }
array
PossrepObject
public java.lang.Object evaluate(java.lang.String expr)
DSession
Duro types map to Java classes as follows:
boolean
java.lang.Boolean
string
java.lang.String
integer
java.lang.Integer
float
java.lang.Double
binary
byte[]
tuple { ... }
Tuple
relation { ... }
java.util.Set
array
array integer
is converted to
java.lang.Integer[]
.PossrepObject
public void evaluate(java.lang.String expr, java.lang.Object dest)
DSession
expr
and stores the
value in dest
.
The type of expr
must have possreps and dest
must have a setter for each property.public <T> T evaluate(java.lang.String expr, java.lang.Class<T> destClass)
DSession
destClass
and returns that instance.
If destClass
is an interface, a dynamic proxy is created.
Otherwise, the default constructor of destClass
is called.public void setVar(java.lang.String name, java.lang.Object v)
setVar
in class DSession
name
- The name of the variablev
- The valueDException
- If a Duro error occurs.java.lang.IllegalArgumentException
- If v does not match the type of the variable.