Package org.drools.spi

Examples of org.drools.spi.FieldExtractor


                                                                               conf.getDialectRegistry(),
                                                                               mvelDialect );

        final InstrumentedDeclarationScopeResolver declarationResolver = new InstrumentedDeclarationScopeResolver();
       
        final FieldExtractor extractor = ClassFieldExtractorCache.getExtractor( Cheese.class, "price",
                                                                                getClass().getClassLoader() );
       
        final Pattern pattern = new Pattern( 0,
                                             new ClassObjectType( int.class ) );
        final Declaration declaration = new Declaration( "a",
View Full Code Here


                if ( !fieldIndex.isHashed() ) {
                    continue;
                }
                // this field is hashed so set the existing hashKey and see if there is a sink for it
                final int index = fieldIndex.getIndex();
                final FieldExtractor extractor = fieldIndex.getFieldExtactor();
                this.hashKey.setValue( index,
                                       object,
                                       extractor );
                final ObjectSink sink = (ObjectSink) this.hashedSinkMap.get( this.hashKey );
                if ( sink != null ) {
View Full Code Here

                    if ( !fieldIndex.isHashed() ) {
                        continue;
                    }

                    final int index = fieldIndex.getIndex();
                    final FieldExtractor extractor = fieldIndex.getFieldExtactor();
                    this.hashKey.setValue( index,
                                           object,
                                           extractor );
                    final ObjectSink sink = (ObjectSink) this.hashedSinkMap.get( this.hashKey );
                    if ( sink != null ) {
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

     */
    public Object getValue(InternalWorkingMemory workingMemory, Object object) {
        for( Iterator it = this.extractors.entrySet().iterator(); it.hasNext(); ) {
            Map.Entry entry = (Map.Entry) it.next();
            String var = (String) entry.getKey();
            FieldExtractor extr = (FieldExtractor) entry.getValue();
           
            this.variables.put( var, extr.getValue( workingMemory, object ));
        }
        return MVEL.executeExpression( mvelExpression, this.variables );
    }
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.