private boolean isPropertyConstrained(PropertyDescriptor p, boolean useField) {
// cascaded counts as constrained
// we must know if the @Valid annotation is on a field or a getter
JClassType jClass = beanHelper.getJClass();
if (useField &&
jClass.findField(p.getPropertyName()).isAnnotationPresent(Valid.class)) {
return true;
} else if (!useField &&
jClass.findMethod(asGetter(p),NO_ARGS).isAnnotationPresent(Valid.class)) {
return true;
}