-
1. Re: inherited annotations
js8523 Mar 1, 2006 4:25 AM (in response to coryvirok)I've tried this and all the annotations work apart from the datamodel and datamodelselection (for some reason it won't inject the datamodelselection when it should be).
I had to implement anything datamodel related in the sub classes.
HTH,
James -
2. Re: inherited annotations
coryvirok Mar 1, 2006 10:22 AM (in response to coryvirok)Thanks for the reply. I've gone over pretty much every possible combination of placing the DataModel annotations and have not gotten it to work in any place other than the subclass, just like you mentioned.
I do, however, see some interesting behavior in regards to the @Factory annotation when I have it in the base, (abstract) class.
Seems like even though the @Factory method is in the abstract class, it gets called and fills the model's list up with values. Not only does it get called once, but it gets called a second time and even though there are values in the data model, the dataTable never gets any elements to list out...
Here's the setup:@Local public interface Test { // @DataModel //Doesn't work public List<String> getNames(); public void setNames(List<String> names); // @DataModelSelection("names") //Doesn't work public String getName(); public void setName(String name); // @Factory("names") //Doesn't work public void setupNames(); } public abstract class TestBase implements Test { @Factory("names") //Gets called twice when the dataTable uses #{names} public void setupNames(){ List<String> names = new LinkedList<String>(); names.add("Cory"); names.add("Dave"); setNames(names); } } @Stateful @Name("test") @Interceptors(SeamInterceptor.class) public class TestBean extends TestBase implements Test { @DataModel List<String> names; @DataModelSelection("names") String name; public String getName() { return name; } public List<String> getNames() { return names; } public void setName(String name) { this.name = name; } public void setNames(List<String> names) { this.names = names; } //*No* Factory annotation since it's listed in the base class } <!-- With the @Factory annotation in the base class, nothing is ever listed here, even though "names" gets filled correctly... --> <h:dataTable value="#{names}" var="n"> <h:column> #{n} </h:column> </h:dataTable>
Is this a bug, a feature? Also, to get back to the original question, do you know of any future support for inherrited @DataModel annotations?
Also, which other annotations did you try that worked?
Thanks,
- Cory -
3. Re: inherited annotations
gavin.king Mar 1, 2006 6:34 PM (in response to coryvirok)Yes, a bad limitation in Seam is that Component does not scan superclasses for annotations.
I will add this to JIRA. -
5. Re: inherited annotations
coryvirok Mar 1, 2006 6:39 PM (in response to coryvirok)Sounds like a good addition.
Thanks,
- Cory