1 Reply Latest reply on Sep 25, 2008 12:42 PM by Stuart Douglas

    enums as SEAM-managed components or usage of @Factory in Enums

    Rene Felgenträger Newbie

      Is it possible / or planned to support ENUMs as SEAM-managed Components or a limitated support for enums?


      I would love to make a List of Enums available in my Frontend and place this logic in my enum-class. I was thinking about something like this in my enum-class called AllocationEditType :


         @Factory(autoCreate=true,value="allocationEditTypeRejections")
          public static List<AllocationEditType> getAllocationEditTypeRejections() {
              return AllocationEditType.getEditTypeRejections();
          }
          
          @Factory(autoCreate=true,value="allocationEditTypeAcceptances")
          public static List<AllocationEditType> getAllocationEditTypeAcceptances() {
              return AllocationEditType.getEditTypeAcceptances();
          }




      For the usage of @Factory, i have to annotate the enum-class with the @Name, otherwise the @Factory will have no affect. The @Name causes seam to instantiate the enum, which is not possible due to the nature of an enum (no public contructors allowed!) and will throw an InstantiationException.


      Isnt it a good idea/practice that seam also scans for @Factory-method in classes which dont have a name annotation?
      I dislike the Fact, that i have to create another pojo-class which makes the enums as a list available for the frontend


      Greetings