[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Method & constructor validation pointcuts
|
Ok, I need another pair of eyeballs again. I'm refining my earlier pointcuts
one baby step at a time. Now, instead of restricting validation annotations
to "javax.validation.constraints..*", I want to allow for any @Constraint
annotation, which really means any annotation annotated with @Constraint.
For example, for my own @NotEmpty (simple test annotation to test for null
or empty String):
========================
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.validation.Constraint;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
@NotNull
@Size(min = 1)
@Constraint(validatedBy = {})
@Retention(RetentionPolicy.SOURCE)
@Target({ ElementType.FIELD, ElementType.PARAMETER })
public @interface NotEmpty {}
========================
I tried the following, but they only match constraint annotations whose
package is "javax.validation.constraints":
pointcut executingValidatedConstructorParameters() :
execution(*.new(.., @(@javax.validation.Constraint *) (*), ..));
pointcut executingValidatedReturnValue() :
execution(@(@javax.validation.Constraint *) !static !void *(..));
pointcut executingValidatedMethodParameters() :
execution(!static * *(.., @(@javax.validation.Constraint *) (*), ..));
I just saw this thread saying it's not supported, posted Dec 2010:
http://forum.springsource.org/showthread.php?99738-Pointcut-to-match-meta-annotations&p=334966#post334966
Is it still not supported? If not, then I'm surprised that the above
aspects are even partially working.
Ideally, I'd like to support meta-annnotations, meta-meta-annotations, etc.,
generally. Is that possible?
-matthew
--
View this message in context: http://aspectj.2085585.n4.nabble.com/Method-constructor-validation-pointcuts-tp4650536p4650545.html
Sent from the AspectJ - users mailing list archive at Nabble.com.