Hi all,

I'm trying to use the class-field property in a java semantics module and I'm having an issue with boolean properties. I am trying to access a property named isPrimary which returns a boolean like so:

        <parameter identifier="primary">
<class-field field="primary" value="true">GenericComparable</class-field>
        </parameter>

I get an exception from this stating that

org.drools.smf.FactoryException: Field 'primary' does not exist for Class 'GenericComparable'.

I know this does exist, and after looking at the drools code, I see the following:

            // make sure field getter exists
clazz.getMethod( "get" + fieldName.toUpperCase( ).charAt ( 0 ) + fieldName.substring( 1 ),
                             (Class[]) null );

which obviously doesn't work because my accessor starts with "is". Is there any plan to support something like this in the future (it's been in the JavaBean spec for a while, in section 8.3.2)?

By the way, I tried to change my getter just to see if it works, but it still fails on the following in ClassFieldObjectType.matches(), because it returns a Boolean (true) and compares that to a String ("true").

result = this.getterMethod.invoke( object, ( Object[] )null ).equals ( this.getFieldValue( ) )

Can we use boolean types in class-field?

Thanks for a great api,
Jason

Reply via email to