Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Is it possible to modify the subject type based on the presence of a certain annotation on a type's method?

Could not find how to do it, so I declare an error instead, like this:
===================================================
public aspect LogMeAspect extends LoggerAspect {
  ...
  private pointcut logMeTypeScope() : within(@LogMe *);
  declare error : !within(ILoggable+) && !logMeTypeScope() &&
execution(@LogMe * *.*(..)) :
    "{advice.aspecttype}: The method
{joinpoint.signature.declaringType}.{joinpoint.signature.name} (line
{joinpoint.sourcelocation.line}) is annotated with the @LogMe annotation,
but the declaring type is neither @LogMe annotated nor implements the
ILoggable interface.";
}
===================================================

Is this the best way to enforce the desired semantics? 

Thanks.

--
View this message in context: http://aspectj.2085585.n4.nabble.com/Is-it-possible-to-modify-the-subject-type-based-on-the-presence-of-a-certain-annotation-on-a-type-s--tp4210440p4210538.html
Sent from the AspectJ - users mailing list archive at Nabble.com.


Back to the top