Package org.drools.core.spi

Examples of org.drools.core.spi.InternalReadAccessor


       
       
       
        Declaration declr = p.addDeclaration( "age" );

        final InternalReadAccessor extractor = PatternBuilder.getFieldReadAccessor(context,
                                                                                   new BindingDescr("age", "age"),
                                                                                   p.getObjectType(),
                                                                                   "age",
                                                                                   declr,
                                                                                   true);
View Full Code Here


        AccessorKey key = new AccessorKey( pkgName + className,
                                           expr,
                                           AccessorKey.AccessorType.FieldAccessor );
        FieldLookupEntry entry = (FieldLookupEntry) this.lookup.get( key );
        if ( entry == null ) {
            InternalReadAccessor reader  = getReadAcessor( className, expr, typesafe, returnType );
            entry = new FieldLookupEntry( reader );
            this.lookup.put( key,
                             entry );
        }
View Full Code Here

    public void wire() {
        for ( Entry<AccessorKey, BaseLookupEntry> entry : lookup.entrySet() ) {
            switch ( entry.getValue().getAccessorType() ) {
                case FieldAccessor : {
                    InternalReadAccessor reader = ((FieldLookupEntry) entry.getValue()).getClassFieldReader();
                    if ( reader != null ) {
                        wire( reader );
                    }

                    ClassFieldWriter writer = ((FieldLookupEntry) entry.getValue()).getClassFieldWriter();
View Full Code Here

                if ( indexableConstraint.isIndexable(NodeTypeEnums.AlphaNode) && indexableConstraint.getField() != null &&
                        indexableConstraint.getFieldExtractor().getValueType() != ValueType.OBJECT_TYPE &&
                        // our current implementation does not support hashing of deeply nested properties
                        !( indexableConstraint.getFieldExtractor() instanceof MVELObjectClassFieldReader )) {
                    final InternalReadAccessor readAccessor = indexableConstraint.getFieldExtractor();
                    final int index = readAccessor.getIndex();
                    final FieldIndex fieldIndex = registerFieldIndex( index,
                                                                      readAccessor );

                    if ( fieldIndex.getCount() >= this.alphaNodeHashingThreshold && this.alphaNodeHashingThreshold != 0 ) {
                        if ( !fieldIndex.isHashed() ) {
View Full Code Here

                if ( indexableConstraint.isIndexable(NodeTypeEnums.AlphaNode) && indexableConstraint.getField() != null &&
                        indexableConstraint.getFieldExtractor().getValueType() != ValueType.OBJECT_TYPE &&
                        // our current implementation does not support hashing of deeply nested properties
                        !( indexableConstraint.getFieldExtractor() instanceof MVELObjectClassFieldReader )) {
                    final InternalReadAccessor fieldAccessor = indexableConstraint.getFieldExtractor();
                    final int index = fieldAccessor.getIndex();
                    final FieldIndex fieldIndex = unregisterFieldIndex( index );

                    if ( fieldIndex.isHashed() ) {
                        HashKey hashKey = new HashKey( index,
                                                       value,
View Full Code Here

        if ( this.hashedSinkMap == null ) {
            this.hashedSinkMap = new ObjectHashMap();
        }

        final int index = fieldIndex.getIndex();
        final InternalReadAccessor fieldReader = fieldIndex.getFieldExtractor();

        ObjectSinkNode currentSink = this.hashableSinks.getFirst();

        while ( currentSink != null ) {
            final AlphaNode alphaNode = (AlphaNode) currentSink;
View Full Code Here

            boolean needsPrimitive = ! ( expectedTypeDescr.startsWith( "L" ) || expectedTypeDescr.startsWith( "[" ) );
            String returnedType = isObject ? "Ljava/lang/Object;" : typeDescr(declaration.getTypeName());
            mv.visitMethodInsn(INVOKEVIRTUAL, Declaration.class.getName().replace('.', '/'), readMethod,
                               "(L" + InternalWorkingMemory.class.getName().replace('.', '/') +";Ljava/lang/Object;)" + returnedType);
            if (isObject) {
                InternalReadAccessor extractor = declaration.getExtractor();
                if (extractor != null) {
                    cast(extractor.getExtractToClass());
                }
            }

            if ( needsPrimitive && isObject ) {
                castToPrimitive( convertPrimitiveNameToType( declarationType) );
View Full Code Here

                                   new TestAbstractImpl() ) );
    }

    @Test
    public void testInherited() throws Exception {
        final InternalReadAccessor ex = store.getReader( BeanInherit.class,
                                                         "text",
                                                         getClass().getClassLoader() );
        assertEquals( "hola",
                      ex.getValue( null,
                                   new BeanInherit() ) );
    }
View Full Code Here

                                   new BeanInherit() ) );
    }

    @Test
    public void testSelfReference() throws Exception {
        final InternalReadAccessor ex = store.getReader( BeanInherit.class,
                                                         "this",
                                                         getClass().getClassLoader() );
        final TestBean bean = new TestBean();
        assertEquals( bean,
                      ex.getValue( null,
                                   bean ) );
    }
View Full Code Here

    public BetaNodeFieldConstraint getBoundVariableConstraint(final Class clazz,
                                                              final String fieldName,
                                                              final Declaration declaration,
                                                              final String evaluatorString) throws IntrospectionException {

        final InternalReadAccessor extractor = store.getReader( clazz,
                                                                fieldName,
                                                                getClass().getClassLoader() );
        String expression = fieldName + " " + evaluatorString + " " + declaration.getIdentifier();
        return new MvelConstraintTestUtil(expression, declaration, extractor);
    }
View Full Code Here

TOP

Related Classes of org.drools.core.spi.InternalReadAccessor

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.