The ClassObjectType
semantic component differentiates objects
by the same rules as the Java type hierarchy. It is constructed using the
Class
of the class or interface to match. The underlying
implementation uses isAssignableFrom
and so accomodates
subclasses and interface implementations cleanly.
ObjectType type = new ClassObjectType( Person.class );
The ExprCondition
semantic component applies a boolean-yielding
Java expression to the input objects. It is constructed with a string encapsulating
the expression along with an array of available declarations.
Condition condition = new ExprCondition( "person.isTall()", new Declaration[] { personDecl, wifeDecl } );
The BlockConsequence
semantic component allows blocks of Java statements
to be executed as the consequence of a rule. It is constructed with a string
encapsulating the statement block along with an array of available declarations.
The block is executed by BeanShell and thus is
actually a superset of normal Java.
Consequence consequence = new BlockConsequence( "System.err.println( \"person is: \" + person.getName() );", new Declaration[] { personDecl, wifeDecl } );