Drools does not look at the class attributes. All he cares are the methods. In your example:

rule "Some Rule"
 when
       $MyFact :A( $first : first )
  then

    Will work just fine, because when drools see "first", he will look for a method called either "getFirst()" or "isFirst()" or in last case "first()".

    []s
    Edson



2008/5/8 sridhar123 <sridhar.peddinti@sabre.com>:

I am trying to access Fact objects that are not always java beans. Example:

Class A {
 Arraylist  Class B b

 getFirst() { return b.first() }

 }

In above Class i dont have any variable called "first" - but returning first
element of the list.

Now following DRL throws compilation errors.

rule "Some Rule"
 when
       $MyFact :A()
       $first : $myFact.getFirst()
  then
      ....
      ....
end

Is there any way to execute the above - or i should have class variable
"first" and access that?

thank you
Sridhar
--
View this message in context: http://www.nabble.com/Facts---can-they-be-non-Java-Beans-tp17130130p17130130.html
Sent from the drools - user mailing list archive at Nabble.com.

_______________________________________________
rules-users mailing list
rules-users@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/rules-users



--
Edson Tirelli
JBoss Drools Core Development
Office: +55 11 3529-6000
Mobile: +55 11 9287-5646
JBoss, a division of Red Hat @ www.jboss.com