[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] ITD Annotation

I have the following aspect that detects updates to an object. The problem is that the Transient annotation on the ITD is NOT introduced. Is this the expected behavior? The only workaround I’ve considered is to use a DeclareAnnotation, but unfortunately this is not currently supported.

 

@Aspect

public class DomainStateAspect {

 

    public interface DomainState {

      boolean isDirty();

      void setDirty(boolean dirty);

    };

 

    public static class DomainStateImpl implements DomainState {

 

      private boolean dirty = false;

 

      public boolean isDirty() {

            return dirty;

      }

     

      public void setDirty(boolean dirty) {

            this.dirty = dirty;

      }

    }

 

    @DeclareParents(value="domain.*", defaultImpl=DomainStateImpl.class)

    @Transient

    private DomainState domainState;

       

    @AfterReturning("set(domain.* *) && target(bean) && args(value) && !withincode(*.new(..))")

    public void dirty(JoinPoint.StaticPart jp, Object bean, Object value) throws Throwable {

      ((DomainState)bean).setDirty(true);

    }

}