@Test public void testDeclaration() { InternalKnowledgePackage pkg = new KnowledgePackageImpl( "org.store" ); final FieldTemplate cheeseName = new FieldTemplateImpl( "name", 0, String.class ); final FieldTemplate cheesePrice = new FieldTemplateImpl( "price", 1, Integer.class ); final FieldTemplate[] fields = new FieldTemplate[]{cheeseName, cheesePrice}; final FactTemplate cheese = new FactTemplateImpl( pkg, "Cheese", fields ); final InternalReadAccessor extractName = new FactTemplateFieldExtractor( cheese, 0 ); final Pattern pattern = new Pattern( 0, new FactTemplateObjectType( cheese ) ); final Declaration declaration = new Declaration( "typeOfCheese", extractName, pattern ); final Fact brie = cheese.createFact( 12 ); brie.setFieldValue( "name", "brie" ); brie.setFieldValue( "price", new Integer( 55 ) ); assertEquals( "brie", declaration.getValue( null, brie ) ); }
public Object getValue(InternalWorkingMemory workingMemory, final Object object) { return ((Fact) object).getFieldValue( this.fieldIndex ); }
FactTemplateFieldExtractor implements
    Externalizable,
    org.drools.core.spi.InternalReadAccessor { public Object getValue(InternalWorkingMemory workingMemory, final Object object) { return ((Fact) object).getFieldValue( this.fieldIndex ); } }
FactTemplateFieldExtractor implements
    Externalizable,
    org.drools.core.spi.InternalReadAccessor { public Object getValue(InternalWorkingMemory workingMemory, final Object object) { return ((Fact) object).getFieldValue( this.fieldIndex ); } FactTemplateFieldExtractor();  FactTemplateFieldExtractor(final FactTemplate factTemplate,
                                      final int fieldIndex); }
FactTemplateFieldExtractor implements
    Externalizable,
    org.drools.core.spi.InternalReadAccessor { public Object getValue(InternalWorkingMemory workingMemory, final Object object) { return ((Fact) object).getFieldValue( this.fieldIndex ); } FactTemplateFieldExtractor();  FactTemplateFieldExtractor(final FactTemplate factTemplate,
                                      final int fieldIndex); void readExternal(ObjectInput in); void writeExternal(ObjectOutput out); ValueType getValueType(); Object getValue(InternalWorkingMemory workingMemory,
                           final Object object); int getIndex(); Class getExtractToClass(); String getExtractToClassName(); boolean getBooleanValue(InternalWorkingMemory workingMemory,
                                   final Object object); byte getByteValue(InternalWorkingMemory workingMemory,
                             final Object object); char getCharValue(InternalWorkingMemory workingMemory,
                             final Object object); double getDoubleValue(InternalWorkingMemory workingMemory,
                                 final Object object); float getFloatValue(InternalWorkingMemory workingMemory,
                               final Object object); int getIntValue(InternalWorkingMemory workingMemory,
                           final Object object); long getLongValue(InternalWorkingMemory workingMemory,
                             final Object object); short getShortValue(InternalWorkingMemory workingMemory,
                               final Object object); Method getNativeReadMethod(); String getNativeReadMethodName(); int getHashCode(InternalWorkingMemory workingMemory,
                           final Object object); boolean isGlobal(); boolean isSelfReference(); boolean isNullValue(InternalWorkingMemory workingMemory,
                               Object object); boolean getBooleanValue(Object object); byte getByteValue(Object object); char getCharValue(Object object); double getDoubleValue(Object object); float getFloatValue(Object object); int getHashCode(Object object); int getIntValue(Object object); long getLongValue(Object object); short getShortValue(Object object); Object getValue(Object object); BigDecimal getBigDecimalValue(Object object); BigInteger getBigIntegerValue(Object object); BigDecimal getBigDecimalValue(InternalWorkingMemory workingMemory,
                                         Object object); BigInteger getBigIntegerValue(InternalWorkingMemory workingMemory,
                                         Object object); boolean isNullValue(Object object); @Override int hashCode(); @Override boolean equals(Object obj); }
FactTemplateFieldExtractor implements
    Externalizable,
    org.drools.core.spi.InternalReadAccessor { public Object getValue(InternalWorkingMemory workingMemory, final Object object) { return ((Fact) object).getFieldValue( this.fieldIndex ); } FactTemplateFieldExtractor();  FactTemplateFieldExtractor(final FactTemplate factTemplate,
                                      final int fieldIndex); void readExternal(ObjectInput in); void writeExternal(ObjectOutput out); ValueType getValueType(); Object getValue(InternalWorkingMemory workingMemory,
                           final Object object); int getIndex(); Class getExtractToClass(); String getExtractToClassName(); boolean getBooleanValue(InternalWorkingMemory workingMemory,
                                   final Object object); byte getByteValue(InternalWorkingMemory workingMemory,
                             final Object object); char getCharValue(InternalWorkingMemory workingMemory,
                             final Object object); double getDoubleValue(InternalWorkingMemory workingMemory,
                                 final Object object); float getFloatValue(InternalWorkingMemory workingMemory,
                               final Object object); int getIntValue(InternalWorkingMemory workingMemory,
                           final Object object); long getLongValue(InternalWorkingMemory workingMemory,
                             final Object object); short getShortValue(InternalWorkingMemory workingMemory,
                               final Object object); Method getNativeReadMethod(); String getNativeReadMethodName(); int getHashCode(InternalWorkingMemory workingMemory,
                           final Object object); boolean isGlobal(); boolean isSelfReference(); boolean isNullValue(InternalWorkingMemory workingMemory,
                               Object object); boolean getBooleanValue(Object object); byte getByteValue(Object object); char getCharValue(Object object); double getDoubleValue(Object object); float getFloatValue(Object object); int getHashCode(Object object); int getIntValue(Object object); long getLongValue(Object object); short getShortValue(Object object); Object getValue(Object object); BigDecimal getBigDecimalValue(Object object); BigInteger getBigIntegerValue(Object object); BigDecimal getBigDecimalValue(InternalWorkingMemory workingMemory,
                                         Object object); BigInteger getBigIntegerValue(InternalWorkingMemory workingMemory,
                                         Object object); boolean isNullValue(Object object); @Override int hashCode(); @Override boolean equals(Object obj);  }