[JBoss JIRA] (CDI-580) Allow interceptors and decorators to be applied to the return value of a producer method
by Stephan Knitelius (JIRA)
[ https://issues.jboss.org/browse/CDI-580?page=com.atlassian.jira.plugin.sy... ]
Stephan Knitelius commented on CDI-580:
---------------------------------------
That would be solved by defining the interceptors for the product as an attribute of the produces annotation.
@Produces(interceptors={MyInterceptor.class})
> Allow interceptors and decorators to be applied to the return value of a producer method
> ----------------------------------------------------------------------------------------
>
> Key: CDI-580
> URL: https://issues.jboss.org/browse/CDI-580
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Beans
> Affects Versions: 2.0-EDR1
> Reporter: Mark Struberg
>
> Currently the spec explicitly disallows to apply interceptors and decorators to contextual instances created by producer fields and producer methods.
> if you add an Interceptor annotation to a producer method then only the invocation of the producermethod gets intercepted. The created Contextual Instance will remain a plain object.
> We should explore ways to allow this somehow.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 10 months
[JBoss JIRA] (CDI-580) Allow interceptors and decorators to be applied to the return value of a producer method
by Martin Kouba (JIRA)
[ https://issues.jboss.org/browse/CDI-580?page=com.atlassian.jira.plugin.sy... ]
Martin Kouba updated CDI-580:
-----------------------------
Summary: Allow interceptors and decorators to be applied to the return value of a producer method (was: Allow interceptors and decorators to be applied to producer methods)
> Allow interceptors and decorators to be applied to the return value of a producer method
> ----------------------------------------------------------------------------------------
>
> Key: CDI-580
> URL: https://issues.jboss.org/browse/CDI-580
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Beans
> Affects Versions: 2.0-EDR1
> Reporter: Mark Struberg
>
> Currently the spec explicitly disallows to apply interceptors and decorators to contextual instances created by producer fields and producer methods.
> if you add an Interceptor annotation to a producer method then only the invocation of the producermethod gets intercepted. The created Contextual Instance will remain a plain object.
> We should explore ways to allow this somehow.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 10 months
[JBoss JIRA] (CDI-580) Allow interceptors and decorators to be applied to producer methods
by Martin Kouba (JIRA)
[ https://issues.jboss.org/browse/CDI-580?page=com.atlassian.jira.plugin.sy... ]
Martin Kouba commented on CDI-580:
----------------------------------
bq. Missing default constructor or why?
No. Producers are often used for integration with third-party libraries where the classes are not annotated at all.
> Allow interceptors and decorators to be applied to producer methods
> -------------------------------------------------------------------
>
> Key: CDI-580
> URL: https://issues.jboss.org/browse/CDI-580
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Beans
> Affects Versions: 2.0-EDR1
> Reporter: Mark Struberg
>
> Currently the spec explicitly disallows to apply interceptors and decorators to contextual instances created by producer fields and producer methods.
> if you add an Interceptor annotation to a producer method then only the invocation of the producermethod gets intercepted. The created Contextual Instance will remain a plain object.
> We should explore ways to allow this somehow.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 10 months
[JBoss JIRA] (CDI-580) Allow interceptors and decorators to be applied to producer methods
by Stephan Knitelius (JIRA)
[ https://issues.jboss.org/browse/CDI-580?page=com.atlassian.jira.plugin.sy... ]
Stephan Knitelius commented on CDI-580:
---------------------------------------
[~mkouba] Missing default constructor or why?
Wouldn't that be the same issue as when applying a normal scope to the product....
WELD-001435: Normal scoped bean class com.knitelius.NonDefaultConBean is not proxyable because it has no no-args constructor
> Allow interceptors and decorators to be applied to producer methods
> -------------------------------------------------------------------
>
> Key: CDI-580
> URL: https://issues.jboss.org/browse/CDI-580
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Beans
> Affects Versions: 2.0-EDR1
> Reporter: Mark Struberg
>
> Currently the spec explicitly disallows to apply interceptors and decorators to contextual instances created by producer fields and producer methods.
> if you add an Interceptor annotation to a producer method then only the invocation of the producermethod gets intercepted. The created Contextual Instance will remain a plain object.
> We should explore ways to allow this somehow.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 10 months
[JBoss JIRA] (CDI-515) Allow to obtain Bean metadata from javax.enterprise.inject.Instance
by Martin Kouba (JIRA)
[ https://issues.jboss.org/browse/CDI-515?page=com.atlassian.jira.plugin.sy... ]
Martin Kouba commented on CDI-515:
----------------------------------
That would be way more complicated if possible at all. Let's assume you have two producers for dependent {{Foo}} and each specifies a different qualifer. Then you inject {{Instance<Foo>}} and select Instance for qualifier {{@A}} and get instance of Foo, and select Instance for qualifier {{@B}} and get instance of Foo. How would you differentiate these instances? What happens if you pass Foo {{@B}} reference to the Instance for Foo {{@A}}? You would have to track all the instances provied by each Instance.
> Allow to obtain Bean metadata from javax.enterprise.inject.Instance
> -------------------------------------------------------------------
>
> Key: CDI-515
> URL: https://issues.jboss.org/browse/CDI-515
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Affects Versions: 1.2.Final
> Reporter: Martin Kouba
> Assignee: Martin Kouba
> Fix For: 2.0 (proposed)
>
>
> Sometimes it might be useful to obtain Bean metadata from the {{javax.enterprise.inject.Instance}} (similarly as 5.5.8. Bean metadata). The method could be named {{getBean()}} and should have similar restrictions like {{get()}} (e.g. throw {{UnsatisfiedResolutionException}} if appropriate).
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 10 months
[JBoss JIRA] (CDI-515) Allow to obtain Bean metadata from javax.enterprise.inject.Instance
by Antoine Sabot-Durand (JIRA)
[ https://issues.jboss.org/browse/CDI-515?page=com.atlassian.jira.plugin.sy... ]
Antoine Sabot-Durand commented on CDI-515:
------------------------------------------
If we want to provide the same service than in 5.5.8 we need to provide a {{getBean(T)}} to allow retrieving a bean from one of its instance. IMO this would be far more useful.
> Allow to obtain Bean metadata from javax.enterprise.inject.Instance
> -------------------------------------------------------------------
>
> Key: CDI-515
> URL: https://issues.jboss.org/browse/CDI-515
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Affects Versions: 1.2.Final
> Reporter: Martin Kouba
> Assignee: Martin Kouba
> Fix For: 2.0 (proposed)
>
>
> Sometimes it might be useful to obtain Bean metadata from the {{javax.enterprise.inject.Instance}} (similarly as 5.5.8. Bean metadata). The method could be named {{getBean()}} and should have similar restrictions like {{get()}} (e.g. throw {{UnsatisfiedResolutionException}} if appropriate).
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 10 months
[JBoss JIRA] (CDI-580) Allow interceptors and decorators to be applied to producer methods
by Martin Kouba (JIRA)
[ https://issues.jboss.org/browse/CDI-580?page=com.atlassian.jira.plugin.sy... ]
Martin Kouba commented on CDI-580:
----------------------------------
I remember that this has been discussed many times and the main problem was how to declare the interceptor bindings - because the "product" class usually cannot be modified.
> Allow interceptors and decorators to be applied to producer methods
> -------------------------------------------------------------------
>
> Key: CDI-580
> URL: https://issues.jboss.org/browse/CDI-580
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Beans
> Affects Versions: 2.0-EDR1
> Reporter: Mark Struberg
>
> Currently the spec explicitly disallows to apply interceptors and decorators to contextual instances created by producer fields and producer methods.
> if you add an Interceptor annotation to a producer method then only the invocation of the producermethod gets intercepted. The created Contextual Instance will remain a plain object.
> We should explore ways to allow this somehow.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 10 months
[JBoss JIRA] (CDI-580) Allow interceptors and decorators to be applied to producer methods
by Mark Struberg (JIRA)
[ https://issues.jboss.org/browse/CDI-580?page=com.atlassian.jira.plugin.sy... ]
Mark Struberg commented on CDI-580:
-----------------------------------
Yes, you could have an @Transactional which needs to get applied for the method invocation itself, and another interceptor, say @Logging, which gets applied to the produced instance.
> Allow interceptors and decorators to be applied to producer methods
> -------------------------------------------------------------------
>
> Key: CDI-580
> URL: https://issues.jboss.org/browse/CDI-580
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Beans
> Affects Versions: 2.0-EDR1
> Reporter: Mark Struberg
>
> Currently the spec explicitly disallows to apply interceptors and decorators to contextual instances created by producer fields and producer methods.
> if you add an Interceptor annotation to a producer method then only the invocation of the producermethod gets intercepted. The created Contextual Instance will remain a plain object.
> We should explore ways to allow this somehow.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 11 months
[JBoss JIRA] (CDI-580) Allow interceptors and decorators to be applied to producer methods
by Romain Manni-Bucau (JIRA)
[ https://issues.jboss.org/browse/CDI-580?page=com.atlassian.jira.plugin.sy... ]
Romain Manni-Bucau commented on CDI-580:
----------------------------------------
I dont think so, the flag will be for new methods so the user controls it. If an issue 2.1 can add interceptors method but an extension could, worse case, change the model anyway.
> Allow interceptors and decorators to be applied to producer methods
> -------------------------------------------------------------------
>
> Key: CDI-580
> URL: https://issues.jboss.org/browse/CDI-580
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Beans
> Affects Versions: 2.0-EDR1
> Reporter: Mark Struberg
>
> Currently the spec explicitly disallows to apply interceptors and decorators to contextual instances created by producer fields and producer methods.
> if you add an Interceptor annotation to a producer method then only the invocation of the producermethod gets intercepted. The created Contextual Instance will remain a plain object.
> We should explore ways to allow this somehow.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 11 months
[JBoss JIRA] (CDI-580) Allow interceptors and decorators to be applied to producer methods
by Stephan Knitelius (JIRA)
[ https://issues.jboss.org/browse/CDI-580?page=com.atlassian.jira.plugin.sy... ]
Stephan Knitelius commented on CDI-580:
---------------------------------------
Maybe we should differentiate between Interceptors applied to the producer method and the created bean.
Something like @Produces(interceptors={MyInterceptorAnnotation.class});
> Allow interceptors and decorators to be applied to producer methods
> -------------------------------------------------------------------
>
> Key: CDI-580
> URL: https://issues.jboss.org/browse/CDI-580
> Project: CDI Specification Issues
> Issue Type: Feature Request
> Components: Beans
> Affects Versions: 2.0-EDR1
> Reporter: Mark Struberg
>
> Currently the spec explicitly disallows to apply interceptors and decorators to contextual instances created by producer fields and producer methods.
> if you add an Interceptor annotation to a producer method then only the invocation of the producermethod gets intercepted. The created Contextual Instance will remain a plain object.
> We should explore ways to allow this somehow.
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
8 years, 11 months