[jboss-dev-forums] [Design the new POJO MicroContainer] - Re: MDR doesn't work on annotated privates (Repost)
adrian@jboss.org
do-not-reply at jboss.com
Wed Aug 13 11:11:59 EDT 2008
"wolfc" wrote : anonymous wrote :
| | My concern would be whether AOP needs to also use annotations on the
| | method during the invocation and so know to use this Signature?
| Not right now, because the EJB3 container sets up a manual interceptor chain. In future this chain should also come from aop.xml, then it might become a problem.
|
| Note that both web container & client container have so far been left out of scope.
|
That's not what I meant. If the method is enhanced using an AOP aspect,
it may want access to the annotations, e.g.
| @PostConstruct
| @LogCalls(level=Leves.TRACE)
| private void postConstruct() {}
|
| @Aspect
| public CallLogging
| {
| public Object invoke(MethodInvocation invocation) throws Throwable
| {
| // This effectively does
| // advisor.getMetaData().getComponentMetaData(new MethodSignature(invocation.getMethod())).getAnnotation(LogCalls.class)
| LogCalls logCalls = invocation.getAnnotation(LogCalls.class);
|
| // Impl
| doLog(logCalls, invocation);
| }
| }
|
Which would kind of work as it currently stands (since it doesn't validate the method).
The "kind of" is because it is not intended to work, and wouldn't work
if you don't use the constructor with the Method in it.
If you don't pass the Method object, it has to search for the Method
and will instead find the one in Sub.class.
anonymous wrote : Is there a Jira for the new method signature?
No JIRA, since we haven't decided what the proper solution is yet.
As I see it there are currently two possible solutions:
1) Your's which is to introduce a new Signature, but this is going to be
non-transparent to users, at least it doesn't interfere with more normal usages.
2) Morph MethodSignature to understand the "optional" class as part of the key.
But this would complicate the equals()/hashCode() used to store
and retrieve component metadata, e.g. Instance level metadata
populated from the xml
It would no longer be a simple get/put() semantic which would make writing
MetaDataLoaders overly complicated and error prone.
Callers who don't use the Method constructor would still have to know/pass the
declaring class when constructing the signature to get the super method.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4170354#4170354
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4170354
More information about the jboss-dev-forums
mailing list