-
1. Re: Can I define Bijection in code (instead of annotations)?
sherkan777 Jun 22, 2009 2:28 PM (in response to gbo3006)Yes u can inject/outject by calling Component
Contexts.getApplicationContext().set("hotNews", hotNews); Contexts.getApplicationContext().get("hotNews");
by EL u can call object, but I don't know hot outject, but I think this sould be possible. Like in JSF form and input field or other field.
-
2. Re: Can I define Bijection in code (instead of annotations)?
swd847 Jun 22, 2009 11:31 PM (in response to gbo3006)The answer to the @Out question is probably not. It is possible to get a reference to the Component metamodel and manually add a Bijected attribute, however if the class does not already have any @In's or @Out's then the BijectionInterceptor will be disabled, so it won't work anyway. It may be possible to get this to work, but it is the sort of thing that stands a good chance of breaking between releases. If you want to play around with it here is some code to get you started:
Component c = (Component)Contexts.getApplicationContext().get("myComponent.component"); List<BijectedAttribute<Out>> attributes = c.getOutAttributes(); //now you have to create your own bijected field and add it to the list, the ones that //seam uses are not public. You should be able to implment the interface yourself. List<Interceptor> interceptors = c.getInterceptors(InterceptorType.ANY); boolean found = false; for(Interceptor i : interceptors) { if(BijectionInterceptor.class.isAssignableFrom(i.getClass())) { found = true; break; } } if(!found) { c.addInterceptor(new BijectionInterceptor()); }
Note that this code is totally untested and certainly not something that is in any way supported.
It is much easier to add factory method expression programmaticly, I use Init.instance().addFactoryMethodExpression().
-
3. Re: Can I define Bijection in code (instead of annotations)?
gbo3006 Jul 8, 2009 4:37 PM (in response to gbo3006)Thanks guys! Basically I've needed it to overcome the seam-cannot-bind-conversation-scoped component issue. After struggling with the code trying your suggestions, I've revert to the school-like solution of creating an event-scoped child component.
Thanks,
Gilad