Package org.drools.spi

Examples of org.drools.spi.FieldValue


        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);

        // With Memory
        final AlphaNode alphaNode = new AlphaNode( buildContext.getNextId(),
View Full Code Here


        final InternalReadAccessor extractor = store.getReader( Cheese.class,
                                                                "type",
                                                                getClass().getClassLoader() );

        final FieldValue field = FieldFactory.getInstance().getFieldValue( "cheddar" );

        final MvelConstraint constraint = new MvelConstraintTestUtil("type == \"cheddar\"", field, extractor);

        final AlphaNode alphaNode = new AlphaNode( buildContext.getNextId(),
                                                   constraint,
View Full Code Here

        final InternalReadAccessor extractor = store.getReader( Cheese.class,
                                                                "type",
                                                                getClass().getClassLoader() );

        final FieldValue field = FieldFactory.getInstance().getFieldValue( "cheddar" );

        final MvelConstraint constraint = new MvelConstraintTestUtil("type == \"cheddar\"", field, extractor);

        final AlphaNode alphaNode = new AlphaNode( buildContext.getNextId(),
                                                   constraint,
View Full Code Here

     */
    private void checkEvaluatorMethodWithFieldValue(final ValueType valueType,
                                                    final InternalReadAccessor extractor,
                                                    final Object[] row,
                                                    final Evaluator evaluator) {
        final FieldValue value = FieldFactory.getFieldValue( row[2] );
        final boolean result = evaluator.evaluate( null,
                                                   extractor,
                                                   row[0],
                                                   value );
        final String message = "The evaluator type: [" + valueType + "] with FieldValue incorrectly returned " + result + " for [" + row[0] + " " + row[1] + " " + row[2] + "]. It was asserted to return " + row[3];
View Full Code Here

import org.drools.spi.FieldValue;

public class FieldFactoryTest extends TestCase {

    public void testBigDecimal() {
        final FieldValue val = FieldFactory.getFieldValue( "42.42",
                                                           ValueType.BIG_DECIMAL_TYPE );
        assertEquals( BigDecimal.class,
                      val.getValue().getClass() );
        assertTrue( val.getValue().equals( new BigDecimal( "42.42" ) ) );
    }
View Full Code Here

                      val.getValue().getClass() );
        assertTrue( val.getValue().equals( new BigDecimal( "42.42" ) ) );
    }

    public void testBigInteger() {
        final FieldValue val = FieldFactory.getFieldValue( "424242",
                                                           ValueType.BIG_INTEGER_TYPE );
        assertEquals( BigInteger.class,
                      val.getValue().getClass() );
        assertTrue( val.getValue().equals( new BigInteger( "424242" ) ) );
    }
View Full Code Here

    }

    public void testDate() throws Exception {
      SimpleDateFormat df = new SimpleDateFormat("dd-MMM-yyyy");
      String s = df.format(df.parse("10-Jul-1974"));
        final FieldValue val = FieldFactory.getFieldValue( s, ValueType.DATE_TYPE );
        assertEquals( Date.class, val.getValue().getClass() );

        Date dt = (Date) val.getValue();
        assertEquals(s, df.format(dt));

    }
View Full Code Here

    private void checkEvaluatorMethodWithFieldValue(final ValueType valueType,
                                                    final InternalReadAccessor extractor,
                                                    final Object[] row,
                                                    final Evaluator evaluator) {
        final FieldValue value = FieldFactory.getFieldValue( row[2] );
        RuntimeDroolsException exc = null;
        try {
            evaluator.evaluate( null,
                                extractor,
                                row[0],
View Full Code Here

    private FieldFactory() {
    }

    public static FieldValue getFieldValue(final String value,
                                           ValueType valueType) {
        FieldValue field = null;
        if ( value == null ) {
            valueType = ValueType.NULL_TYPE;
        }

        if ( valueType == ValueType.NULL_TYPE ) {
View Full Code Here

        return field;
    }

    public static FieldValue getFieldValue(final Object value,
                                           ValueType valueType) {
        FieldValue field = null;
        if ( value == null ) {
            valueType = ValueType.NULL_TYPE;
        }

        if ( valueType == ValueType.NULL_TYPE ) {
View Full Code Here

TOP

Related Classes of org.drools.spi.FieldValue

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.