1 Reply Latest reply on May 24, 2007 9:10 PM by Tony Herstell

    Enums - Useage

    Tony Herstell Master

      Given:

      <ice:menuItem id="bookingIndoorArenaMenuOption"
       value="#{messages.menu_item_book_indoor_arena}"
       action="#{availabilityController.showAvailability(Resource.instance.ResourceKind.INDOOR_ARENA)}">
       <s:conversationPropagation type="none" />
      </ice:menuItem>
      
      <ice:menuItem id="bookingMenageIntArenaOption"
       value="#{messages.menu_item_book_int_arena}"
       action="#{availabilityController.showAvailability('INT_ARENA')}">
       <s:conversationPropagation type="none" />
      </ice:menuItem>
      


      You can see above what I would LIKE to do (pass an Enum to the Controller as a parameter) and you can see what I have to do (and then do some coversion in teh code).

      Is there a way to do this in Seam?

      @SuppressWarnings("serial")
      @Entity // Defines this as an Entity that is a class mapped to the Datastore.
      @Name("resource") // Name used within SEAM for an instance of this class.
      public class Resource implements Serializable {
      
       public enum ResourceKind {
       INDOOR_ARENA ("resource_indoor_arena"),
       INT_ARENA ("resource_int_arena"),
       SJ_ARENA ("resource_sj_arena"),
       CONF_ROOM ("resource_conf_room"),
       CAFE ("resource_cafe");
       private final String inlLabel;
       ResourceKind(String inlLabel) {
       this.inlLabel = inlLabel;
       }
       public String getInlLabel() { return inlLabel; }
       }
      


        • 1. Re: Enums - Useage
          Tony Herstell Master

          Actually I really want to do this:

          <ice:menuItem id="bookingIndoorArenaMenuOption"
           value="#{messages.Resource.instance.ResourceKind.INDOOR_ARENA.inlLabel}"
           action="#{availabilityController.showAvailability(
          Resource.instance.ResourceKind.INDOOR_ARENA
          )}">
           <s:conversationPropagation type="none" />
          </ice:menuItem>