use of org.minijax.validator.metadata.MinijaxPropertyDescriptor in project minijax by minijax.
the class MinijaxValidator method validate.
@Override
public <T> Set<ConstraintViolation<T>> validate(final T object, final Class<?>... groups) {
final MinijaxConstraintValidatorContext<T> context = new MinijaxConstraintValidatorContext<>(object);
final BeanDescriptor descriptor = getConstraintsForClass(object.getClass());
for (final PropertyDescriptor propertyDescriptor : descriptor.getConstrainedProperties()) {
final Object value = ((MinijaxPropertyDescriptor) propertyDescriptor).getValue(object);
validateProperty(context, propertyDescriptor, value);
}
return context.getResult();
}
use of org.minijax.validator.metadata.MinijaxPropertyDescriptor in project minijax by minijax.
the class MinijaxValidator method validateProperty.
@Override
public <T> Set<ConstraintViolation<T>> validateProperty(final T object, final String propertyName, final Class<?>... groups) {
final MinijaxConstraintValidatorContext<T> context = new MinijaxConstraintValidatorContext<>(object);
final BeanDescriptor descriptor = getConstraintsForClass(object.getClass());
final PropertyDescriptor propertyDescriptor = descriptor.getConstraintsForProperty(propertyName);
final Object value = ((MinijaxPropertyDescriptor) propertyDescriptor).getValue(object);
validateProperty(context, propertyDescriptor, value);
return context.getResult();
}
Aggregations