-
1. Re: CDI and polymorphic producer methods
guidbona.guidbona.yahoo.com Sep 30, 2011 5:41 AM (in response to beligum.b.beligum.org)Hi Bram,
Please don't take it bad, but I think that your pattern is actually an anti-pattern: should you use your Target in Java code, you would use some instanceof to access properties and methods from different implementations, which means that you are breaking OO good practices; the fact that you do this in a more natural way because EL is non-type safe is not a real excuse. That said, I admit that I've also used this pattern quite a lot, especially with entities, having similar problems with Hibernate's proxies :P
Depending on the case, I would enrich the Target interface to satisfy all the needs of the page, or I would use alternative JSF script chunks to address each specific Target implementation (using... well... some kind of instanceof on the page side).
I hope this helps...
-
2. Re: CDI and polymorphic producer methods
beligum.b.beligum.org Dec 27, 2011 6:03 AM (in response to beligum.b.beligum.org)Hi Guido,
(sorry for this - way - overdue reply)
You're right, I guess. It's painfully easy to access the non-accessible method/properties outside of the interface, which is why I've grown accustomed to use it as a pattern. Thanks for the insight.
b.