[rules-users] Accessing a property of an Enum (LHS)

Gras, Patrick Patrick.Gras at generali.ch
Fri Jan 9 05:41:46 EST 2009


Hi,

I'm trying to access to a property of an Enum but I get the following error:

Unable to create restriction '[QualifiedIndentifierRestr: == Direction.S.name ]' for field 'directionAsString' in the rule 'enum test'

Here is the code for my Enum:

public enum Direction {

	N("North"), S("South"), E("East"), W("West");

	private  final String name;

	private Direction(String name) {
		this.name = name;
	}

	public String getName() {
		return this.name;
	}
}

And here is my Rule:

rule "enum test"
	when
		$to : TestObject($ds: directionAsString == Direction.S.name);
	then
		System.err.println("OK");
end


Is there a reason why I cannot do that ?

Thanks for your help
-Patrick

Patrick Gras
GENERALI Assurances 
Service Informatique
Avenue Perdtemps 23
1260 Nyon 1
Tél. direct: +41 58 471 05 87
<mailto:patrick.gras at generali.ch>
P Please consider the environment before printing this E-Mail!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/rules-users/attachments/20090109/3ecfc8e8/attachment.html 


More information about the rules-users mailing list