1 Reply Latest reply on Nov 10, 2006 11:29 AM by pmuir

    DataBinderClass, DataModel and SelectItems

    cavani

      This confuse me:

      In my class (SelectItems from petemuir, before refactor):

      @DataModel
      List actions;
      
      @DataModelSelection
      Action action;
      
      @SelectItems
      List actors;
      


      On startup:

      java.lang.IllegalStateException: Missing value() for @DataModelSelection with multiple @DataModels: assetCustodyFiling
       at org.jboss.seam.Component.initMembers(Component.java:598)
       at org.jboss.seam.Component.<init>(Component.java:248)
       at org.jboss.seam.Component.<init>(Component.java:203)
      ...
      


      I think: well... this is impossible... or not?

      Then I dig in class Component:

       {
       if ( ann.annotationType().isAnnotationPresent(DataBinderClass.class) )
       {
       dataModelGetters.add(method);
       dataModelGetterAnnotations.put(method, ann);
       }
       if ( ann.annotationType().isAnnotationPresent(DataSelectorClass.class) )
       {
       selectionSetters.add(method);
       dataModelSelectionSetterAnnotations.put(method, ann);
       }
       }
      
      // ...
      
       final boolean hasMultipleDataModels = dataModelGetters.size() + dataModelFields.size() > 1;
      // ...
      
       if ( hasMultipleDataModels )
       {
       throw new IllegalStateException( "Missing value() for @DataModelSelection with multiple @DataModels" );
       }
      


      And in petemuir's code:

      @Target({FIELD, METHOD})
      
      @Retention(RUNTIME)
      
      @Documented
      
      @DataBinderClass(SelectItemsBinder.class)
      
      public @interface SelectItems
      
      {
      ...
      


      Then, my universe become normal again....

      I know that DataModel is the only Seam supplied annotation using DataBinderClass, but is not wrong assume that for all?