[cdi-dev] [JBoss JIRA] Updated: (CDI-110) Provide support for binding an invocation handler to an interface or abstract class

Pete Muir (JIRA) jira-events at lists.jboss.org
Tue Mar 22 12:10:46 EDT 2011


     [ https://issues.jboss.org/browse/CDI-110?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pete Muir updated CDI-110:
--------------------------

        Summary: Provide support for binding an invocation handler to an interface or abstract class  (was: Allow injection of abstract classes (Service Handler))
    Description: 
The purpose of this feature is to allow interfaces and abstract classes to be automatically implemented by an invocation handler to which all abstract method invocations are delegated. The invocation handler would get "bound" to the type using the same strategy as is used for interceptor binding.

Binding type:
{code:java}
@Target({ METHOD, TYPE })
@Retention(RetentionPolicy.RUNTIME)
@ServiceHandlerBindingType
public @interface EchoService {}
{code}

Invocation handler:
{code:java}
@ServiceHandlerBindingType
@EchoService
public class EchoServiceHandler {
    @AroundInvoke
    public Object invoke(InvocationContext ctx) {
        return ctx.getMethod().getName().toString();
    }
}
{code}

Usage:

{code:java}
@EchoService
public interface HelloWorld {
   String helloWorld();
}
{code}

  was:
According to mojavelinux:
{quote}
<mojavelinux> service handler, interceptors and decorators are all complementary
<mojavelinux> and cdi is missing the first...which we now realize
{quote}

CDI 1.1 should provide a way to inject abstract classes by specifying a ServiceHandler (Check http://docs.jboss.org/seam/3/solder/latest/reference/en-US/html/servicehandler.html)



> Provide support for binding an invocation handler to an interface or abstract class
> -----------------------------------------------------------------------------------
>
>                 Key: CDI-110
>                 URL: https://issues.jboss.org/browse/CDI-110
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>          Components: Inheritance and Specialization
>    Affects Versions: 1.0
>            Reporter: George Gastaldi
>              Labels: cdi
>             Fix For: TBD
>
>
> The purpose of this feature is to allow interfaces and abstract classes to be automatically implemented by an invocation handler to which all abstract method invocations are delegated. The invocation handler would get "bound" to the type using the same strategy as is used for interceptor binding.
> Binding type:
> {code:java}
> @Target({ METHOD, TYPE })
> @Retention(RetentionPolicy.RUNTIME)
> @ServiceHandlerBindingType
> public @interface EchoService {}
> {code}
> Invocation handler:
> {code:java}
> @ServiceHandlerBindingType
> @EchoService
> public class EchoServiceHandler {
>     @AroundInvoke
>     public Object invoke(InvocationContext ctx) {
>         return ctx.getMethod().getName().toString();
>     }
> }
> {code}
> Usage:
> {code:java}
> @EchoService
> public interface HelloWorld {
>    String helloWorld();
> }
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the cdi-dev mailing list