Package org.drools.spi

Examples of org.drools.spi.FieldExtractor


    private FieldExtractor getFieldExtractor(final RuleBuildContext context,
                                             final BaseDescr descr,
                                             final ObjectType objectType,
                                             final String fieldName,
                                             final boolean reportError) {
        FieldExtractor extractor = null;

        if ( objectType.getValueType() == ValueType.FACTTEMPLATE_TYPE ) {
            //@todo use extractor cache           
            final FactTemplate factTemplate = ((FactTemplateObjectType) objectType).getFactTemplate();
            extractor = new FactTemplateFieldExtractor( factTemplate,
View Full Code Here


                return;
            }
        }

        // if it is not a complex expression, just build a simple field constraint
        final FieldExtractor extractor = getFieldExtractor( context,
                                                            fieldConstraintDescr,
                                                            pattern.getObjectType(),
                                                            fieldName,
                                                            false );
        if ( extractor == null ) {
View Full Code Here

                                                    null,
                                                    "Duplicate declaration for variable '" + fieldBindingDescr.getIdentifier() + "' in the rule '" + context.getRule().getName() + "'" ) );
            return;
        }

        final FieldExtractor extractor = getFieldExtractor( context,
                                                            fieldBindingDescr,
                                                            pattern.getObjectType(),
                                                            fieldBindingDescr.getFieldName(),
                                                            true );
        if ( extractor == null ) {
View Full Code Here

                                                final String identifier,
                                                final Pattern pattern) {
        final FieldBindingDescr implicitBinding = new FieldBindingDescr( identifier,
                                                                         identifier );

        final FieldExtractor extractor = getFieldExtractor( context,
                                                            implicitBinding,
                                                            pattern.getObjectType(),
                                                            implicitBinding.getFieldName(),
                                                            false );
        if ( extractor == null ) {
View Full Code Here

    private FieldExtractor getFieldExtractor(final RuleBuildContext context,
                                             final BaseDescr descr,
                                             final ObjectType objectType,
                                             final String fieldName,
                                             final boolean reportError) {
        FieldExtractor extractor = null;

        if ( objectType.getValueType() == ValueType.FACTTEMPLATE_TYPE ) {
            //@todo use extractor cache           
            final FactTemplate factTemplate = ((FactTemplateObjectType) objectType).getFactTemplate();
            extractor = new FactTemplateFieldExtractor( factTemplate,
View Full Code Here

        final Pattern pattern = new Pattern( context.getNextPatternId(),
                                             0, // offset is 0 by default
                                             objectType,
                                             null );
        ClassLoader classloader = context.getPkg().getPackageCompilationData().getClassLoader();
        final FieldExtractor extractor = context.getDialect().getClassFieldExtractorCache().getExtractorDroolsQuery.class, "name",  classloader );       

        final FieldValue field = FieldFactory.getFieldValue( queryDescr.getName(),
                                                             ValueType.STRING_TYPE );

        final LiteralConstraint constraint = new LiteralConstraint( extractor,
View Full Code Here

public class FieldIndexHashTableTest extends TestCase {
    ClassFieldExtractorCache cache = ClassFieldExtractorCache.getInstance();

    public void testSingleEntry() throws Exception {
        final FieldExtractor extractor = cache.getExtractor( Cheese.class,
                                                             "type",
                                                             getClass().getClassLoader() );

        final Pattern pattern = new Pattern( 0,
                                             new ClassObjectType( Cheese.class ) );
View Full Code Here

                    stiltonEntry.getFirst().getFactHandle() );
        assertNull( stiltonEntry.getFirst().getNext() );
    }

    public void testTwoDifferentEntries() throws Exception {
        final FieldExtractor extractor = cache.getExtractor( Cheese.class,
                                                             "type",
                                                             getClass().getClassLoader() );

        final Pattern pattern = new Pattern( 0,
                                             new ClassObjectType( Cheese.class ) );
View Full Code Here

                    cheddarEntry.getFirst().getFactHandle() );
        assertNull( cheddarEntry.getFirst().getNext() );
    }

    public void testTwoEqualEntries() throws Exception {
        final FieldExtractor extractor = cache.getExtractor( Cheese.class,
                                                             "type",
                                                             getClass().getClassLoader() );

        final Pattern pattern = new Pattern( 0,
                                             new ClassObjectType( Cheese.class ) );
View Full Code Here

        assertSame( stiltonHandle1,
                    ((FactEntryImpl) stiltonEntry.getFirst().getNext()).getFactHandle() );
    }

    public void testTwoDifferentEntriesSameHashCode() throws Exception {
        final FieldExtractor extractor = cache.getExtractor( TestClass.class,
                                                             "object",
                                                             getClass().getClassLoader() );

        final Pattern pattern = new Pattern( 0,
                                             new ClassObjectType( TestClass.class ) );
View Full Code Here

TOP

Related Classes of org.drools.spi.FieldExtractor

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.