[
https://issues.jboss.org/browse/CDI-10?page=com.atlassian.jira.plugin.sys...
]
Mark Struberg commented on CDI-10:
----------------------------------
We would also need to clarify what kind of unwrapping needs to be performed.
In OWB-1.2.x ++ we have a stack of proxies on top of each other. In the maximum scenario
we could get a
1.) NormalScoping Proxy
2.) Interceptor/Decorator Proxy
3.) subclassing proxy if there are abstract Decorators involved
Sometimes you like to get the Contextual Instance with all it's Interceptors and
Decorators, but at some other time you need the real underlying delegation instance (the
_native_ instance without anything else).
The second case is needed if you e.g. like to perform JSR-303 validation on the whole
bean. Or if you like to call private methods on that bean (e.g. delivering messages, etc).
Please note that we need to think about security as well! This needs to be done as
doPrivileged block at least. Not sure what else is necessary to prevent abuse.
Add ability to access a bean instance from a proxy
--------------------------------------------------
Key: CDI-10
URL:
https://issues.jboss.org/browse/CDI-10
Project: CDI Specification Issues
Issue Type: Feature Request
Components: Beans
Affects Versions: 1.0
Reporter: Stuart Douglas
There are occasions when it would be useful to access a bean instance directly from a
proxy. This could be achieved by making all proxies assignable to an interface (say
BeanProxy) that provides a getBeanInstance() method.
Client code that needs access to the actual instance can check if the object is
assignable to the BeanProxy interface and then call getBeanInstance() to get the actual
instance if required.
This is something that is probably more useful to extension writers than the end user,
but there have already been a few requests on the weld forum about this so it is probably
worth considering.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)