Search in sources :

Example 26 with FieldValue

use of org.drools.core.spi.FieldValue in project drools by kiegroup.

the class ReteTesterHelper method getLiteralConstraint.

public AlphaNodeFieldConstraint getLiteralConstraint(final Pattern pattern, final String fieldName, final String evaluatorString, final String value) {
    final Class<?> clazz = ((ClassObjectType) pattern.getObjectType()).getClassType();
    final InternalReadAccessor extractor = store.getReader(clazz, fieldName);
    FieldValue fieldValue = FieldFactory.getInstance().getFieldValue(value, extractor.getValueType());
    return new MvelConstraintTestUtil(fieldName + evaluatorString + value, fieldValue, extractor);
}
Also used : ClassObjectType(org.drools.core.base.ClassObjectType) InternalReadAccessor(org.drools.core.spi.InternalReadAccessor) FieldValue(org.drools.core.spi.FieldValue) MvelConstraintTestUtil(org.drools.core.rule.MvelConstraintTestUtil)

Aggregations

FieldValue (org.drools.core.spi.FieldValue)26 MvelConstraintTestUtil (org.drools.core.rule.MvelConstraintTestUtil)9 MvelConstraint (org.drools.core.rule.constraint.MvelConstraint)9 InternalReadAccessor (org.drools.core.spi.InternalReadAccessor)9 Test (org.junit.Test)9 IOException (java.io.IOException)6 ClassObjectType (org.drools.core.base.ClassObjectType)6 RuleImpl (org.drools.core.definitions.rule.impl.RuleImpl)6 InternalKnowledgeBase (org.drools.core.impl.InternalKnowledgeBase)6 AlphaNodeFieldConstraint (org.drools.core.spi.AlphaNodeFieldConstraint)6 ClassFieldReader (org.drools.core.base.ClassFieldReader)5 WorkingMemory (org.drools.core.WorkingMemory)4 IndexableConstraint (org.drools.core.rule.IndexableConstraint)4 Pattern (org.drools.core.rule.Pattern)4 Cheese (org.drools.core.test.model.Cheese)4 ObjectInput (java.io.ObjectInput)3 ObjectOutput (java.io.ObjectOutput)3 ArrayList (java.util.ArrayList)3 ClassFieldAccessorCache (org.drools.core.base.ClassFieldAccessorCache)3 DefaultFactHandle (org.drools.core.common.DefaultFactHandle)3