[rules-users] get list from map object

Meny Kobel meny.kobel at gmail.com
Tue Apr 21 08:05:11 EDT 2009


Hi,
One of the class member of the fact is map<String,List>.
In the DRL file I need to get list from the map(I know the map key) and set
it to variable name $theList.
Then I need to check if some variable is memberof $theList
Can you please advice how to get the list from the map and set the $theList
variable?

For example :

public class Cheese
{
    private String type;
    private Map<String,List<Integer>> map;


    public Cheese(String type) {
        this.type = type;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public Map<String, List<Integer>> getMap()
    {
        return map;
    }

    public void setMap(Map<String, List<Integer>> map)
    {
        this.map = map;
    }


    public List<Integer> getListFromMap(String name)
    {
        return map.get(name);
    }
}

DRL file -

rule "Cheese_fans_18"
  when
    Cheese($theList :* don't know how to get the list from the map*)
    Cheese(type memberof $theList)

  then
    System.out.println("Cool");
end



Thanks,
Meny
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090421/cadc660b/attachment.html 


More information about the rules-users mailing list