[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] getting the object from a joinpoint
|
Hi,
Perhaps this might help:
http://www.eclipse.org/aspectj/doc/released/faq.html#q:adviseconstructors
I suppose that you can differentiate the types with this:
after() returning(MyClassA a): ConstrCall() { }
after() returning(MyClassB b): ConstrCall() { }
...
Otherwise, "after() returning(Object obj)" and reflection would
certainly work.
Cheers,
Bruno.
mfirrincieli@xxxxxxxxxxxxxxxxx wrote:
mmm
basically what i have to do is start up different tasks when different kinds of
classes are instantiated...
that's why i have a generic
pointcut ConstrCall(): !within(MyAspect) && call(myPackage.*.new(..));
pointcut that executes whenere any new() call (within myPackage is called).
so inside my aspect i need to be able to tell what kind of new is being called.
-m
mfirrincieli@xxxxxxxxxxxxxxxxx wrote:
i'm join-pointing a *.new() kind of call, and i'm getting mad cause then
what
i'd have to do is getting the object called... and i can't seem to make it
possibile by using thisJoinPoint object.
for example if i have
MyClass c = new MyClass();
i do capture that in my aspect, but i'd also like to get the kind of
object
instantiated by new.
Not sure if I understood your question correctly but proceed() returns an
object, and in the case of a constructor that's the new object:
Object around(Object arg): CapturedConstructor(arg) && !within(Cache)
{
...
createdObject = proceed(arg);
...
}
Holger
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users
-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users