users@ejb-spec.java.net

[ejb-spec users] [jsr345-experts] Interceptors 1.2: InvocationContext.getMethod to return actual method for LC interceptors

From: Marina Vatkina <marina.vatkina_at_oracle.com>
Date: Thu, 14 Mar 2013 16:54:55 -0700

Experts,

If you didn't realize that this is an API change, I'm spelling it out here:

The old rule:
"The getMethod method returns the method of the target class for which
the interceptor was invoked. For around-invoke and around-timeout
methods, this is the method on the associated target class; for
lifecycle callback interceptor methods, getMethod returns null."

The proposed rule:
"The getMethod method returns the method of the target class for which
the interceptor was invoked. In a lifecycle callback interceptor for
which there is no corresponding lifecycle callback method on the bean
class or in an AroundConstruct callback intereceptor method, getMethod
returns null"

The reason:
If (see e.g. discussion about @Transactional interceptors and LC
callback methods) an interceptor can be bound to a lifecycle callback
directly (i.e. not at the class-level), it needs be able to access the
values of its members, which would be done via

InvocationContext.getMethod().getAnnotation(Mylinterceptor.class).extra_param()

Let me know ASAP if you see a problem with this change.
thanks,
-marina