[rules-users] How to iterate ArrayList object
Ashok Deivasigamani
ashokdeiva at gmail.com
Thu Jul 9 12:24:31 EDT 2009
I have a Message Object which has a Attribute Object which has a ArrayList
of AttributeParams Objects. How can I iterate through the ArrayList to get
to a perticular AttributeParans Object in the drl file.
The java representation of these Objects are as Follows
Class Message {
private Attributes attributes;
}
Class Attributes {
private ArrayList<AttributeParams> attributeParams;
}
Class AttributeParsms {
private String name;
}
This is my drl file,
when
m : Message( myAttributes : attributes)
then
System.out.println(myAttributes);
System.out.println(myAttributes.getAttributeParams());
System.out.println( myMessage );
when I fire my rule, this is the output I am getting.
com.sample.Attributes at 39c639c6
[com.sample.AttributeParams at 39a639a6, com.sample.AttributeParams at 39ac39ac]
>From the result we can see that we have two Attribute objects in the
ArrayList.
How can I iterate through the ArrayList to get a perticular AttributeParams
object
This is my drl file,
when
m : Message( myAttributes : attributes)
then
System.out.println(myAttributes);
System.out.println(myAttributes.getAttributeParams());
System.out.println( myMessage );
when I fire my rule, this is the output I am getting.
com.sample.Attributes at 39c639c6
[com.sample.AttributeParams at 39a639a6, com.sample.AttributeParams at 39ac39ac]
>From the result we can see that we have two Attribute objects in the
ArrayList.
How can I iterate through the ArrayList to get a perticular AttributeParams
object
--
Ashok Deivasigamani
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090709/2bf9d8e9/attachment.html
More information about the rules-users
mailing list