1 Reply Latest reply on Nov 8, 2009 8:58 PM by nickarls

    annotation processing in Weld

    asookazian

      In reference to this post: http://seamframework.org/Community/AnnotationProcessingInSeam#comment103850 can someone plz elaborate on how Weld and/or components/interceptors/services in EE 6 process annotations?


      I'm specifically interested in proxies (if applicable) and how they are required and work in this context.  thx.



      When a client invokes an EJB method using the bean interface, it doesn't work directly on the bean instance.  The container makes beans 'special' by acting as a proxy between the client and the actual bean instance.  This enables the container to provide EJB services to the client on behalf of the bean instance.

      --EJB 3 in Action


      So what is the advantage of using this design pattern? (I read it in GoF but that book really needs to be updated with Java or C# examples and examples other than document/file processing).

        • 1. Re: annotation processing in Weld
          nickarls

          Well, this is pretty much how it has to be done(?). If you have a bean Foo with a method car and want dynamically to attach stuff to it when it is called, you can't be allowed to call Foo.bar directly, you'll have to call a proxy Foo that does its magic before/after calling the method is called. Annotations give instructions on how the proxy is to be constructed and perhaps what the proxy should do.


          I guess this is doable with AOP also but that includes runtime instrumentation magic that has to be woven into the JRE(?)