[rules-users] How to use type-safe enums in rule condition

droolster quant.coder at gmail.com
Tue Nov 12 05:20:11 EST 2013


Hello,

I would like to use type-safe enums in my rules. At the moment I have
situation like this:

public class Country {
    private String name;

    // getter/setters
}

rule "Country"
    when 
        Country ( name == "USA" )
    then
        DO SOMETHING
end

I would like to have something like this:

public enum Country {
    USA ()
    // list of all countries in the world
}

and in the rule I would like to do this:

rule "Country"
    when 
        Country ( name == Country.USA )
    then
        DO SOMETHING
end

Is that possible?

Thanks in advance for your help.






--
View this message in context: http://drools.46999.n3.nabble.com/How-to-use-type-safe-enums-in-rule-condition-tp4026739.html
Sent from the Drools: User forum mailing list archive at Nabble.com.


More information about the rules-users mailing list