[rules-users] How to iterate ArrayList object

Edson Tirelli tirelli at post.com
Thu Jul 9 14:09:24 EDT 2009


    Read the manual. Look for "from" CE.

    []s
    Edson

2009/7/9 Ashok Deivasigamani <ashokdeiva at gmail.com>

> 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
>
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
>


-- 
 Edson Tirelli
 JBoss Drools Core Development
 JBoss by Red Hat @ www.jboss.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090709/b549d5f7/attachment.html 


More information about the rules-users mailing list