3 Replies Latest reply on Sep 2, 2004 9:55 AM by Dennis Kwasniok

    introduction class syntax

    Dennis Kwasniok Newbie

      Hi,

      I have trouble creating a suitable syntax for introductions. The need is to aoptize a whole tree structure while removing single members. The reason is that including these classes in aoptization would lead to stack overflows (similar to a logger interceptor intercepting itself).

      In pointcuts, the expression works like this:

      <bind pointcut="execution(* *->*(..)) AND !execution(* MethodLoggingInterceptor->*(..))">
       <interceptor class="MethodLoggingInterceptor"/>
       </bind>
      


      But a similar construction does not have the proposed effect:

       <introduction class="* AND !LoggableImpl">
       <mixin>
       <interfaces>
       LoggableIF
       </interfaces>
       <class>LoggableImpl</class>
       <construction>new LoggableImpl(this)</construction>
       </mixin>
       </introduction>
      


      If the expression is simply *, every class gets aoptized, leading to stack overflows. The above syntax seems to be arbitrary selecting some classes to excluded, some are included.

      What is the correct syntax for doing such athing?

      greets,

      Dennis

        • 1. Re: introduction class syntax
          Tomasz Nazar Newbie

          Hello

          The solution might be to package adviced and non-adviced classes in two different packages, and instead `*` use sth like:
          `bind ... com.mycompany.aoptized.*`.
          (unless you have quite complicated package tree)

          I don't know if syntax that you provide in the introduction is even supported.

          And btw, what do you need execution-of-everymethod for? You must have some real special requirements..

          Hmm, as I think.. AspectJ's `within` might help, but JBossAOP doesn't provide it. One may use `all(com.MyClass)` instead..

          t.

          • 2. Re: introduction class syntax
            Bill Burke Master

            the syntax is:

            <introduction expr="!class($instanceof{LoggableImpl})" ...>
            


            Yes, the doco sucks. Kabir and I will put some effort into it before the last release.

            Bill

            • 3. Re: introduction class syntax
              Dennis Kwasniok Newbie

              Hey Bill,

              thanks so much! That works just fine. In response to the doco... well, its sometimes hard to figure out how to use some stuff, but mostly it is self-explaining. On the other hand - a bit more would be great! Anyway, thanks again!

              Best Regards,

              Dennis