[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[ews.eclipse.technology.aspectj] AspectJ + Annotations + Inner Classes
|
hi,
I'm the developer of the http://oval.sourceforge.net AspectJ based
object validation package. My library is an annotation based design by
contract implementation. You can for example do something like this:
@Validatable
public class MyClass
{
public setSomething(@NotNull String value)
{
}
}
An AspectJ aspect is used to advise the parameterized methods of classes
annoted with @Validatable. The aspect checks if constraints are applied
to the method parameters and ensures they are satisfied.
I just realized that with my current aspect also the methods of inner
classes are advised, even if they do not have the @Validatable
annotation. Any ideas how I have to change my aspect to avoid this?
Here is a short form of my aspect:
public abstract aspect ValidationAspect
{
pointcut validatableClasses(): within(@Validatable *);
pointcut constructorsWithParameterConstraints(): execution(new(*,..));
pointcut methodsWithParameterConstraints() : execution(* *.*(*,..));
/**
* constructor parameters validation
*/
@SuppressAjWarnings("adviceDidNotMatch")
Object around(): validatableClasses() &&
constructorsWithParameterConstraints()
{
// do stuff here
}
/**
* method parameters validation
*/
@SuppressAjWarnings("adviceDidNotMatch")
Object around(): validatableClasses() && methodsWithParameterConstraints()
{
// do stuff here
}
}
Any help is appreciated.
Sebastian