Package org.drools.spi

Examples of org.drools.spi.FieldExtractor


        final FieldIndexEntry entry = (FieldIndexEntry) getEntries( map )[0];

    }

    public void testRemove() 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


        assertEquals( 0,
                      tablePopulationSize( map ) );
    }

    public void testResize() 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

        }
        return (Entry[]) list.toArray( new Entry[list.size()] );
    }

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

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

    }

    public void testIt() throws Exception {
        ClassFieldExtractorFactory factory = new ClassFieldExtractorFactory();

        FieldExtractor ex = factory.getClassFieldExtractor( TestBean.class,
                                                            "name",
                                                            Thread.currentThread().getContextClassLoader() );
        assertEquals( 0,
                      ex.getIndex() );
        assertEquals( "michael",
                      ex.getValue( null,
                                   new TestBean() ) );
        ex = factory.getClassFieldExtractor( TestBean.class,
                                             "age",
                                             Thread.currentThread().getContextClassLoader() );
        assertEquals( 1,
                      ex.getIndex() );
        assertEquals( 42,
                      ((Number) ex.getValue( null,
                                             new TestBean() )).intValue() );

    }
View Full Code Here

                                             new TestBean() )).intValue() );

    }

    public void testInterface() throws Exception {
        final FieldExtractor ex = cache.getExtractor( TestInterface.class,
                                                      "something",
                                                      getClass().getClassLoader() );
        assertEquals( 0,
                      ex.getIndex() );
        assertEquals( "foo",
                      ex.getValue( null,
                                   new TestInterfaceImpl() ) );
    }
View Full Code Here

                      ex.getValue( null,
                                   new TestInterfaceImpl() ) );
    }

    public void testAbstract() throws Exception {
        final FieldExtractor ex = cache.getExtractor( TestAbstract.class,
                                                      "something",
                                                      getClass().getClassLoader() );
        assertEquals( 0,
                      ex.getIndex() );
        assertEquals( "foo",
                      ex.getValue( null,
                                   new TestAbstractImpl() ) );
    }
View Full Code Here

                      ex.getValue( null,
                                   new TestAbstractImpl() ) );
    }

    public void testInherited() throws Exception {
        final FieldExtractor ex = cache.getExtractor( BeanInherit.class,
                                                      "text",
                                                      getClass().getClassLoader() );
        assertEquals( "hola",
                      ex.getValue( null,
                                   new BeanInherit() ) );
    }
View Full Code Here

                      ex.getValue( null,
                                   new BeanInherit() ) );
    }

    public void testSelfReference() throws Exception {
        final FieldExtractor ex = cache.getExtractor( BeanInherit.class,
                                                      "this",
                                                      getClass().getClassLoader() );
        final TestBean bean = new TestBean();
        assertEquals( bean,
                      ex.getValue( null,
                                   bean ) );
    }
View Full Code Here

public class DeclarationTest extends TestCase {

    ClassFieldExtractorCache cache = ClassFieldExtractorCache.getInstance();

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

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

                      declaration.getPattern().getOffset() );

    }

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

        final Pattern pattern = new Pattern( 5,
                                             new ClassObjectType( Cheese.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.