[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] @DeclareParents and this.getClass()

Hi

I have a problem with the @DeclareParents annotation:
this.getClass() returns the implementation class of the Aspect and not
the "aspected" class.

Is this a bug? Or does any other method exist to get the aspected class?
BTW: I use AspectJ 1.5.3

Here an example:

@Aspect
public class PersistenceAspect {

    public interface IPersistentObject {
        void store();

        void delete();
    }

    public static class PersistentObjectImpl implements
IPersistentObject {

        public void store() {
        }

        public void delete() {
		System.out.println("Class: " + this.getClass())  // Does return
PersistentAspect$PersistentObjectImpl  !?!?!?!?
        }
    }

    @DeclareParents(value = "@lu.vdl.trasal.annotation.PersistentObject
*", defaultImpl = PersistentObjectImpl.class)
    private IPersistentObject implementedInterface;

}


Does anybody have the same problem? (I found some mails with the same
problem but no answer or bug report :-((

Thx for your help