[cdi-dev] [JBoss JIRA] (CDI-78) Clarify how isDelegate() behaves on InjectionPoint, and what happens when an InjectionPoint is injected into a Decorator

Jozef Hartinger (JIRA) jira-events at lists.jboss.org
Tue Aug 21 08:12:17 EDT 2012


    [ https://issues.jboss.org/browse/CDI-78?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12712667#comment-12712667 ] 

Jozef Hartinger commented on CDI-78:
------------------------------------

The tricky part of having

{code:JAVA}
@Inject
InjectionPoint ip
{code}

in a Decorator is that one may have multiple decorated beans such as:

{code:JAVA}
public class Foo implements Readable {

   public int read(CharBuffer cb) {
      return 0;
   }
}

@ApplicationScoped
public class Bar implements Readable {

   public int read(CharBuffer cb) {
      return 0;
   }
}
{code}

Both beans would be decorated by a decorator:

{code:JAVA}
public class ReadableDecorator implements Readable {

   @Inject @Delegate
   Readable delegate;

   @Inject
   InjectionPoint ip;

   public int read(CharBuffer cb) {
      return delegate.read(cb);
   }
}
{code}

The problem is that there is no InjectionPoint metadata to be injected into decorator when the normal-scoped bean (Bar) is decorated. At the same time there is no problem decorating Foo since it is dependent and InjectionPoint metadata is available.
                
> Clarify how isDelegate() behaves on InjectionPoint, and what happens when an InjectionPoint is injected into a Decorator
> ------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CDI-78
>                 URL: https://issues.jboss.org/browse/CDI-78
>             Project: CDI Specification Issues
>          Issue Type: Clarification
>          Components: Decorators
>    Affects Versions: 1.0
>            Reporter: Pete Muir
>            Assignee: Pete Muir
>             Fix For: 1.1.EDR1
>
>
> The InjectionPoint should be that of the injection into the consumer, and isDelegate() should return false.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the cdi-dev mailing list