2 Replies Latest reply on Nov 12, 2009 11:37 AM by jensaug.jens.augustsson.eu

    Is it possible to use an enum when setting a property value?

    jensaug.jens.augustsson.eu

      Hi,


      Can I somehow use an enum when setting a property value in components.xml? Kinduv like


      <component name="paintAction">
           <property name="color" value="red" />
      </component>



      ...I was hoping that Seam would note that the color prop of this component is public enum Color and do a Color.valueOf(red) before passing the value?


      Passing an enum as a method parameter (a.g in an page action) works fine, obviously valueOf is being called in EL method binding.
      Getting an enum property works swell too, of course.


      The example in the Seam ref I do not understand:


      Seam.Component.getInstance("paintAction").paint("red");


      Is this whole expression intended to be used in EL or what? As java it does not compile since casting is not done and red is not an enum.


      cheers,
      Jens