final ClassFieldReader extractor = store.getReader( Cheese.class,
"type",
getClass().getClassLoader() );
final FieldValue field = FieldFactory.getInstance().getFieldValue( "cheddar" );
final MvelConstraint constraint = new MvelConstraintTestUtil("type == \"cheddar\"", field, extractor);
pattern.addConstraint( constraint );
rule1.addPattern( pattern );
rule1.setConsequence( new Consequence() {
private static final long serialVersionUID = 510l;
public void evaluate(final KnowledgeHelper knowledgeHelper,
final WorkingMemory workingMemory) throws Exception {
}
public void readExternal(ObjectInput in) throws IOException,
ClassNotFoundException {
}
public void writeExternal(ObjectOutput out) throws IOException {
}
public String getName() {
return "default";
}
} );
final Rule rule2 = new Rule( "test2" );
final ClassObjectType cheeseObjectType2 = new ClassObjectType( Cheese.class );
final Pattern pattern2 = new Pattern( 0,
cheeseObjectType2 );
final FieldValue field2 = FieldFactory.getInstance().getFieldValue( "stilton" );
final MvelConstraint constraint2 = new MvelConstraintTestUtil("type == \"stilton\"", field, extractor);
pattern2.addConstraint( constraint2 );
rule2.addPattern( pattern2 );