[rules-users] Custom Evaluator compile time error, If I am upgrading from drool 5.0 to 5.3

kashif10 kash452 at yahoo.com
Mon Jan 23 19:23:48 EST 2012


Hi,

Our current code is using drools 5.0.
We have some custom evaluators, which are working fine with 5.0.

example
*Code from Rule:*
Student(code compareCode "426656000, 426979002, 427295004" ) 

Where Student is a class &  "code" is String field in that class. &
compareCode is a custom operator using custom evaluator. as follows.

*code from OP class:*
public static final Operator  COMPARE_CODE  =
Operator.addOperatorToRegistry( "compareCode",
            false );    
    

*Part from Evaluator Definitions class*

   private EvaluatorCache evaluators = new EvaluatorCache() {
	        private static final long serialVersionUID = 100L;
	        {
addEvaluator( ValueType.STRING_TYPE,         D1Operator.COMPARE_CODE,       	   
CodeEvaluator.INSTANCE );
 }
	    };





		public static class CodeEvaluator extends BaseEvaluator {

	        private static final long     serialVersionUID = 100L;
			public final static Evaluator INSTANCE         = new CodeEvaluator();

			public CodeEvaluator() {
	            super( ValueType.STRING_TYPE,
	                   D1Operator.COMPARE_CODE );
	        }

			public boolean evaluate(InternalWorkingMemory workingMemory,
	                                final InternalReadAccessor extractor,
	                                final Object object1,
	                                final FieldValue object2) {
	            final Object value1 = extractor.getValue( workingMemory,
	                                                      object1 );
	            
	            //System.out.println("************* in
CodeEqualEvaluator.evaluate");
	            final Object value2 = object2.getValue();
	            if ( value1 == null ) {
	                return value2 == null;
	            }
	            //return value1.equals( value2 );
	            return  Utility.checkCode((String)value2, (String)value1);
	            
	        }


Problem:
Now If I update my Eclipse Drool plugin to 5.2.1 or 5.3 I start getting
error
 Evaluator  does not support type 'ValueType = 'Object'
 see attached snapshot/

http://drools.46999.n3.nabble.com/file/n3683440/Drool_problem.jpg
Drool_problem.jpg 


Thanks.



--
View this message in context: http://drools.46999.n3.nabble.com/Custom-Evaluator-compile-time-error-If-I-am-upgrading-from-drool-5-0-to-5-3-tp3683440p3683440.html
Sent from the Drools: User forum mailing list archive at Nabble.com.



More information about the rules-users mailing list