Any ideas? Comments?
2010/9/3 Henrique Rebêlo <[email protected]>
> Hi all,
>
> Consider the following simple hierarchy:
>
> class Shape { public void m() {} }
> class Triangle extends Shape { public void m() {} }
>
> along with the simple advice
>
> pointcut callMeth() : call (public void Shape.m());
> *
>
> before
> *(Shape s) : *call*(*public* *void* Shape.m()) && *target*(s){
>
> // advice body
>
> }
> Suppose that I have the following call
>
> Shape s = new Triangle();
> s.m();
>
> I know that the above advice will affect this call, I want to know if there
> is a way to get the static type information of the executing object without
> using reflection. If I use
>
> *
>
> thisJoinPoint
> *.getSignature().getDeclaringType().getName() // this returns type
> *Shape*that is what I want
>
> I can access that information... but the use of the special variable
> thisJoinPoint or thisJoinPointStaticPart refers to Java.lang.reflect... I
> want this constraint because I need to apply such a strategy with Java ME
> platform in which does not support reflection at all.
>
> I also tried inside the body of the advice
>
> s.getClass().getName(); // But this returns only the type of the executing
> object which is Triangle in this case... I dont know how to access the name
> of the static type of the object represented by s which is Shape.
>
> So, You guys (Java and Aspect experts), Do have any ideas on how I can get
> this?
>
> Kind Regards,
>
> Henrique
>
> --
>
> ...............................................................................................................................
> Henrique Rebelo
> http://www.cin.ufpe.br/~hemr
> Informatics Center, UFPE, Brazil
>
--
...............................................................................................................................
Henrique Rebelo
http://www.cin.ufpe.br/~hemr
Informatics Center, UFPE, Brazil
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users