This content has been marked as final.
Show 2 replies
-
1. Re: Polymorphism and SEAM
toby.tobias.hill.gmail.com Nov 25, 2008 7:58 AM (in response to bobc75)Maybe there is some clever way of doing this with the @In feature that I am not aware of. Until someone enlightens you and me I think you should be fine with:
AbstactContentMessages contentMessages = (AbstactContentMessages) Component.getInstance("nameOfSubComp");
I hope it helps.
/Tobias
-
2. Re: Polymorphism and SEAM
gjeudy Nov 25, 2008 3:44 PM (in response to bobc75)If you use
@In AbstractContentMessages contentMessages;
Combined with (can be in a different POJO or EJB class)
@Factory("contentMessages") public AbstractContentMessages create() { // return different subclasses here. }
Would that work? I've been using @Factory extensively to enable the use of a polymorphic EL expression. You can also try out the more obscure @Unwrap annotation, even though I never used it myself. The main difference between the 2 is @Unwrap is called everytime it is referenced. @Factory is only called if the corresponding EL expression can't be resolved in any contexts.