<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7650.28">
<TITLE>Accessing a property of an Enum (LHS)</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=2 FACE="Arial">Hi,</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">I’m trying to access to a property of an Enum but I get the following error:</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Unable to create restriction '[QualifiedIndentifierRestr: == Direction.S.name ]' for field 'directionAsString' in the rule 'enum test'</FONT></P>
<P><FONT SIZE=2 FACE="Arial">Here is the code for my Enum:</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">public enum Direction {</FONT>
</P>
<P> <FONT SIZE=2 FACE="Arial">N("North"), S("South"), E("East"), W("West");</FONT>
</P>
<P> <FONT SIZE=2 FACE="Arial">private final String name;</FONT>
</P>
<P> <FONT SIZE=2 FACE="Arial">private Direction(String name) {</FONT>
<BR> <FONT SIZE=2 FACE="Arial">this.name = name;</FONT>
<BR> <FONT SIZE=2 FACE="Arial">}</FONT>
</P>
<P> <FONT SIZE=2 FACE="Arial">public String getName() {</FONT>
<BR> <FONT SIZE=2 FACE="Arial">return this.name;</FONT>
<BR> <FONT SIZE=2 FACE="Arial">}</FONT>
<BR><FONT SIZE=2 FACE="Arial">}</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">And here is my Rule:</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">rule "enum test"</FONT>
<BR> <FONT SIZE=2 FACE="Arial">when</FONT>
<BR> <FONT SIZE=2 FACE="Arial">$to : TestObject($ds: directionAsString == Direction.S.name);</FONT>
<BR> <FONT SIZE=2 FACE="Arial">then</FONT>
<BR> <FONT SIZE=2 FACE="Arial">System.err.println("OK");</FONT>
<BR><FONT SIZE=2 FACE="Arial">end</FONT>
</P>
<BR>
<P><FONT SIZE=2 FACE="Arial">Is there a reason why I cannot do that ?</FONT>
</P>
<P><FONT SIZE=2 FACE="Arial">Thanks for your help</FONT>
<BR><FONT SIZE=2 FACE="Arial">-Patrick</FONT>
</P>
<P><B><FONT COLOR="#FF0000" SIZE=1 FACE="Arial">Patrick Gras</FONT></B>
<BR><B><FONT COLOR="#800000" SIZE=1 FACE="Arial">GENERALI Assurances</FONT></B>
<BR><FONT COLOR="#808080" SIZE=1 FACE="Arial">Service Informatique</FONT>
<BR><FONT COLOR="#808080" SIZE=1 FACE="Arial">Avenue Perdtemps 23<SPAN LANG="de"></SPAN></FONT>
<BR><SPAN LANG="de"><FONT COLOR="#808080" SIZE=1 FACE="Arial">1260 Nyon 1</FONT></SPAN>
<BR><SPAN LANG="fr"><FONT COLOR="#808080" SIZE=1 FACE="Arial">Tél. direct: +41 58 471 05 87</FONT></SPAN>
<BR><SPAN LANG="fr"><U><FONT COLOR="#0000FF" SIZE=1 FACE="Arial"><<A HREF="mailto:patrick.gras@generali.ch">mailto:patrick.gras@generali.ch</A>></FONT></U></SPAN>
<BR><SPAN LANG="it"><FONT COLOR="#008000" SIZE=6 FACE="Webdings">P<FONT FACE="Courier New"></FONT></FONT></SPAN><SPAN LANG="it"><B></B><B></B><B> <FONT COLOR="#008000" SIZE=2 FACE="Tahoma">Please consider the environment before printing this E-Mail!</FONT></B></SPAN><B><SPAN LANG="fr-ch"></SPAN></B><SPAN LANG="fr-ch"></SPAN><SPAN LANG="fr-ch"></SPAN><SPAN LANG="fr-ch"></SPAN>
</P>
<BR>
</BODY>
</HTML>