title: displaying one of enum values in report
body: <p>I have the report where one field is </p>
  
  <pre><code>&lt;field name="Gender" class="java.lang.Object"&gt;
      &lt;fieldDescription&gt;&lt;![CDATA[gender]]&gt;&lt;/fieldDescription&gt;
  &lt;/field&gt;
  </code></pre>
  
  <p>The gender is an enum field</p>
  
  <pre><code>public enum Gender {
      MALE, FEMALE
  }
  </code></pre>
  
  <p>In the report detail band I wanna display the gender</p>
  
  <pre><code>        &lt;textField isStretchWithOverflow="true" isBlankWhenNull="true"&gt;
              &lt;reportElement style="Detail" x="6716" y="0" width="144" height="29"/&gt;
              &lt;textElement verticalAlignment="Middle" lineSpacing="Single"/&gt;
              &lt;textFieldExpression class="java.lang.String"&gt;&lt;![CDATA[$F{Gender}]]&gt;&lt;/textFieldExpression&gt;
          &lt;/textField&gt;
  </code></pre>
  
  <p>but that textField shows only either enum.male.MALE or enum.female.FEMALE. How can I display text MALE or FEMALE only depends on the Gender value? </p>
  
  <p>When modifying the textField code to the following:</p>
  
  <pre><code>        &lt;textField isStretchWithOverflow="true" isBlankWhenNull="true"&gt;
              &lt;reportElement style="Detail" x="6716" y="0" width="144" height="29"/&gt;
              &lt;textElement verticalAlignment="Middle" lineSpacing="Single"/&gt;
              &lt;textFieldExpression class="java.lang.String"&gt;&lt;![CDATA[($F{Gender} == enum.male.MALE) ? "Male" :
                                                               (($F{Gender} == enum.female.FEMALE) ? "Female" :
                                                                 "No gender")]]&gt;&lt;/textFieldExpression&gt;
          &lt;/textField&gt;
  </code></pre>
  
  <p>I get the following errors:</p>
  
  <pre><code>org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jasperViewResolver' defined in class path resource [spring/webmvc-config.xml]: Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myreport' defined in ServletContext resource [/WEB-INF/reports/reportviews.xml]: Initialization of bean failed; nested exception is org.springframework.context.ApplicationContextException: Could not parse JasperReports report from ServletContext resource [/WEB-INF/reports/OL001_Opiskelijalista.jrxml]; nested exception is net.sf.jasperreports.engine.JRException: Errors were encountered when compiling report expressions class file:
  1. Syntax error on token "enum", invalid Expression
                  value = (java.lang.String)((((java.lang.Object)field_Gender.getValue()) == enum.male.MALE) ? "Male" : //$JR_EXPR_ID=120$
                                                                                             &lt;--&gt;
  2. Syntax error on token "enum", invalid Expression
                                                                   ((((java.lang.Object)field_Gender.getValue()) == enum.female.FEMALE) ? "Female" : //$JR_EXPR_ID=120$
                                                                                                                    &lt;--&gt;
  3. Syntax error on token "enum", invalid Expression
                  value = (java.lang.String)((((java.lang.Object)field_Gender.getOldValue()) == enum.male.MALE) ? "Male" : //$JR_EXPR_ID=120$
                                                                                                &lt;--&gt;
  4. Syntax error on token "enum", invalid Expression
                                                                   ((((java.lang.Object)field_Gender.getOldValue()) == enum.female.FEMALE) ? "Female" : //$JR_EXPR_ID=120$
                                                                                                                       &lt;--&gt;
  5. Syntax error on token "enum", invalid Expression
                  value = (java.lang.String)((((java.lang.Object)field_Gender.getValue()) == enum.male.MALE) ? "Male" : //$JR_EXPR_ID=120$
                                                                                             &lt;--&gt;
  6. Syntax error on token "enum", invalid Expression
                                                                   ((((java.lang.Object)field_Gender.getValue()) == enum.female.FEMALE) ? "Female" : //$JR_EXPR_ID=120$
                                                                                                                    &lt;--&gt;
  6 errors
  </code></pre>