[jboss-user] [JBoss Seam] - DataBinderClass, DataModel and SelectItems

cavani do-not-reply at jboss.com
Fri Nov 10 11:23:45 EST 2006


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? 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3984963#3984963

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3984963



More information about the jboss-user mailing list