Fwd: [jsr345-experts] AroundConstruct interceptor
by Pete Muir
FYI
Begin forwarded message:
> From: Marina Vatkina <marina.vatkina(a)oracle.com>
> Subject: [jsr345-experts] AroundConstruct interceptor
> Date: 5 February 2013 13:41:01 EST
> To: jsr345-experts(a)ejb-spec.java.net, users(a)interceptors-spec.java.net, Pete Muir <pmuir(a)redhat.com>, Emmanuel Bernard <emmanuel(a)hibernate.org>
>
> This is the extended description of the proposal:
>
> 1. AroundConsruct interceptor
>
> The AroundConstruct annotation denotes lifecycle callback interceptor methods that interpose on invocation of the target instance constructor.
>
> The AroundConstruct interceptor methods may be only defined on interceptor classes and/or superclasses of interceptor classes.
>
> When the AroundConstruct lifecycle callback, if any, is invoked the following rules apply:
> * The AroundConstruct lifecycle callback is invoked after the dependency injection has been completed on the interceptor instance. Injection of the target component into interceptor instances that are invoked during the AroundConstruct lifecycle callback, is not supported.
> * The target instance is created and its constructor injection is performed, if any, when the last interceptor method in the AroundConstruct interceptor chain invokes the InvocationContext.proceed method.
> * The AroundConstruct interceptor method can access the constructed instance using InvocationContext.getTarget method after the InvocationContext.proceed completes.
> * An AroundConstruct lifecycle callback interceptor method should not invoke any business methods of the target instance.
> * The dependency injection on the target instance is not completed until after invocation of all interceptor methods in the AroundConstruct interceptor chain complete successfully.
> * The PostConstruct lifecycle callback, if any, is invoked after the dependency injection has been completed on the target instance.
>
> If the AroundConstruct lifecycle callback is not associated with the target instance, all interceptor methods, including PostConstruct callbacks, if any, are invoked after dependency injection has been completed on both, the interceptor instances and the target instance.
>
>
> 2. Extending InvocationContext interface
>
> a) The InvocationContext interface will be extended with the getConstructor method:
>
> public Constructor getConstructor();
>
> The getConstructor method returns the constructor of the target class for which the AroundConstruct interceptor was invoked. For around-invoke, around-timeout and all other lifecycle callback interceptor methods, getConstructor returns null.
>
>
> b) The getTarget method description will be modified as follows:
>
> The getTarget method returns the associated target instance; for the AroundConstruct lifecycle callback interceptor method, getTarget returns null if called before proceed method returns.
>
> c) No changes are required for the getMethod and getTimer methods of the InvocationContext as they are already required to return null for lifecycle callback interceptor methods
>
> Best,
> -marina
>
>
11 years, 10 months
[JBoss JIRA] (CDI-320) Clarify whether ProcessAnnotatedType should be fired for annotations
by Ron Šmeral (JIRA)
[ https://issues.jboss.org/browse/CDI-320?page=com.atlassian.jira.plugin.sy... ]
Ron Šmeral commented on CDI-320:
--------------------------------
I agree with your comments on CDI-269, but the current wording says: The container must fire an event, before it processes [...] Annotated type added by BeforeBeanDiscovery.addAnnotatedType().
I can do {{bbd.addAnnotatedType(AnnotatedType<Annotation>)}} and expect to have it processed, because the spec says that PAT will be fired for *each* AnnotatedType added in BBD.
> Clarify whether ProcessAnnotatedType should be fired for annotations
> --------------------------------------------------------------------
>
> Key: CDI-320
> URL: https://issues.jboss.org/browse/CDI-320
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Portable Extensions
> Reporter: Ron Šmeral
>
> It should be stated clearly whether {{ProcessAnnotatedType}} should be fired for annotations.
> Currently, *11.5.6 ProcessAnnotatedType event* says:
> {quote}
> The container must fire an event, before it processes a type, for each:
> * Java class, interface or enum in a bean archive,
> {quote}
> The word "annotation" has been introduced into the above line and later reverted.
> {quote}
> * Annotated type added by {{BeforeBeanDiscovery.addAnnotatedType()}},
> {quote}
> The wording used here, however, doesn't exclude the option of the annotated type being an Annotation.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 10 months
[JBoss JIRA] (CDI-320) Clarify whether ProcessAnnotatedType should be fired for annotations
by Mark Struberg (JIRA)
[ https://issues.jboss.org/browse/CDI-320?page=com.atlassian.jira.plugin.sy... ]
Mark Struberg commented on CDI-320:
-----------------------------------
The current wording is pretty explicit that there is no PAT for annotations. And imo this is good that way. See my last comment in CDI-269
> Clarify whether ProcessAnnotatedType should be fired for annotations
> --------------------------------------------------------------------
>
> Key: CDI-320
> URL: https://issues.jboss.org/browse/CDI-320
> Project: CDI Specification Issues
> Issue Type: Clarification
> Components: Portable Extensions
> Reporter: Ron Šmeral
>
> It should be stated clearly whether {{ProcessAnnotatedType}} should be fired for annotations.
> Currently, *11.5.6 ProcessAnnotatedType event* says:
> {quote}
> The container must fire an event, before it processes a type, for each:
> * Java class, interface or enum in a bean archive,
> {quote}
> The word "annotation" has been introduced into the above line and later reverted.
> {quote}
> * Annotated type added by {{BeforeBeanDiscovery.addAnnotatedType()}},
> {quote}
> The wording used here, however, doesn't exclude the option of the annotated type being an Annotation.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 10 months
[JBoss JIRA] (CDI-269) Fire ProcessAnnotatedType for annotations
by Mark Struberg (JIRA)
[ https://issues.jboss.org/browse/CDI-269?page=com.atlassian.jira.plugin.sy... ]
Mark Struberg commented on CDI-269:
-----------------------------------
Imo we decided in an EG meeting to *not* implement this, right?
The reason is that we would need to introduce another 'phase' because we would need to first fire PAT for *all* annotations and only _after_ that we could fire the PAT.
If we just fire PAT for all annotations at the time they pop up during scanning, this would cause random results. E.g. if you create a @Stereotype via PAT or add a @Nonbinding to an interceptor binding, then this would result in different scenarios depending on whether you get this annotation as first class or as very last in the chain. This is pretty bad...
> Fire ProcessAnnotatedType for annotations
> -----------------------------------------
>
> Key: CDI-269
> URL: https://issues.jboss.org/browse/CDI-269
> Project: CDI Specification Issues
> Issue Type: Bug
> Affects Versions: 1.1.EDR
> Reporter: Pete Muir
> Assignee: Pete Muir
> Fix For: 1.1.PRD
>
>
> If we fire a PAT event for annotations, the members can have @Nonbinding added
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 10 months
[JBoss JIRA] (CDI-320) Clarify whether ProcessAnnotatedType should be fired for annotations
by Ron Šmeral (JIRA)
Ron Šmeral created CDI-320:
------------------------------
Summary: Clarify whether ProcessAnnotatedType should be fired for annotations
Key: CDI-320
URL: https://issues.jboss.org/browse/CDI-320
Project: CDI Specification Issues
Issue Type: Clarification
Components: Portable Extensions
Reporter: Ron Šmeral
It should be stated clearly whether {{ProcessAnnotatedType}} should be fired for annotations.
Currently, *11.5.6 ProcessAnnotatedType event* says:
{quote}
The container must fire an event, before it processes a type, for each:
* Java class, interface or enum in a bean archive,
{quote}
The word "annotation" has been introduced into the above line and later reverted.
{quote}
* Annotated type added by {{BeforeBeanDiscovery.addAnnotatedType()}},
{quote}
The wording used here, however, doesn't exclude the option of the annotated type being an Annotation.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
11 years, 10 months