[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Stand-alone advice?

Hi Asad,

I touched on this in the other thread that was talking about named
signature patterns a day or so ago.  Currently you can't do this, but
it wouldn't be too hard to add support for wiring aspects up in XML.
You can already define concrete aspects in XML, which concretize
abstract aspects (by filling in abstract pointcuts), but you can't
build them from scratch by defining a pointcut and naming a Java
method.

The best you could do right now is allow the users to define pointcuts
and very simply advice bodies that called your framework advices.

class Framework {
  static void advice1(JoinPoint.StaticPart jpsp) {
     System.out.println(jpsp);
  }
}

then the user just has to write something small

aspect X {
  before(): execution(* *(..)) { Framework.advice1(thisJoinPointStaticPart); }
}

I guess it depends on whether you want them writing aspects (and so
compiling them), or you want them to express that in some other form
(like XML)?

cheers
Andy

On 20 September 2011 14:04, Amina & Asad Jawahar <room7hostel4@xxxxxxxxx> wrote:
> Hi,
> I am new to AspectJ and considering to use it for a framework that I am developing. I want to provide some advices as part of the framework that users of my framework should be able to use with their own pointcuts. I see that in Spring AOP this is doable because you can reference advices and pointcuts to compose arbitrary aspects (at least from the examples it looks like it) but I could not find a way in AspectJ. Is there a way to just provide an advice in AspectJ and let someone else construct an Aspect using it?
>
> Thanks,
> -Asad
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>