Class AbstractGwtSpecificValidator<G>
- java.lang.Object
-
- de.knightsoftnet.validators.client.impl.AbstractGwtSpecificValidator<G>
-
- Type Parameters:
G- the type object to validate
- All Implemented Interfaces:
GwtSpecificValidator<G>
public abstract class AbstractGwtSpecificValidator<G> extends Object implements GwtSpecificValidator<G>
Base methods for implementing aGwtSpecificValidator.All methods that do not need to be generated go here.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAbstractGwtSpecificValidator.AttributeBuilderBuilds attributes one at a time.
-
Constructor Summary
Constructors Constructor Description AbstractGwtSpecificValidator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected List<Class<?>>addDefaultGroupWhenEmpty(List<Class<?>> pgroups)protected <V,T,A extends Annotation>
voidaddSingleViolation(GwtValidationContext<T> context, Set<javax.validation.ConstraintViolation<T>> violations, G object, V value, ConstraintDescriptorImpl<A> constraintDescriptor)static AbstractGwtSpecificValidator.AttributeBuilderattributeBuilder()protected static Class<?>[]groupsToClasses(Group... groups)<T> Set<javax.validation.ConstraintViolation<T>>validate(GwtValidationContext<T> context, G object, Class<?>... groups)Validates all constraints onobject.protected <A extends Annotation,T,V>
booleanvalidate(GwtValidationContext<T> context, Set<javax.validation.ConstraintViolation<T>> violations, G object, V value, javax.validation.ConstraintValidator<A,? super V> validator, ConstraintDescriptorImpl<A> constraintDescriptor, Class<?>... groups)Perform the actual validation of a singleConstraintValidator.<T> Set<javax.validation.ConstraintViolation<T>>validateProperty(GwtValidationContext<T> context, G object, String propertyName, Class<?>... groups)Validates all constraints placed on the property ofobjectnamedpropertyName.<T> Set<javax.validation.ConstraintViolation<T>>validateValue(GwtValidationContext<T> context, Class<G> beanType, String propertyName, Object value, Class<?>... groups)Validates all constraints placed on the property namedpropertyNameof the classbeanTypewhere the property value isvalue.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface de.knightsoftnet.validators.client.impl.GwtSpecificValidator
expandDefaultAndValidateClassGroups, expandDefaultAndValidatePropertyGroups, expandDefaultAndValidateValueGroups, getBeanMetadata, getConstraints, validateClassGroups, validatePropertyGroups, validateValueGroups
-
-
-
-
Method Detail
-
attributeBuilder
public static AbstractGwtSpecificValidator.AttributeBuilder attributeBuilder()
-
validate
public <T> Set<javax.validation.ConstraintViolation<T>> validate(GwtValidationContext<T> context, G object, Class<?>... groups)
Description copied from interface:GwtSpecificValidatorValidates all constraints onobject.- Specified by:
validatein interfaceGwtSpecificValidator<G>- Type Parameters:
T- the type of the RootBean for this validation context- Parameters:
context- The gwt validation contextobject- object to validategroups- group or list of groups targeted for validation (default toDefault)- Returns:
- constraint violations or an empty Set if none
-
validate
protected <A extends Annotation,T,V> boolean validate(GwtValidationContext<T> context, Set<javax.validation.ConstraintViolation<T>> violations, G object, V value, javax.validation.ConstraintValidator<A,? super V> validator, ConstraintDescriptorImpl<A> constraintDescriptor, Class<?>... groups)
Perform the actual validation of a singleConstraintValidator.As a side effect
ConstraintViolations may be added toviolations.- Type Parameters:
A- the type of the annotationT- the type of the class to validateV- the type of the value to validate- Parameters:
context- validation contextviolations- set of violationsobject- objectvalue- value to validatevalidator- validator to useconstraintDescriptor- constraint descriptorgroups- validation groups to take care of- Returns:
- true if there was any constraint violations
-
validateProperty
public <T> Set<javax.validation.ConstraintViolation<T>> validateProperty(GwtValidationContext<T> context, G object, String propertyName, Class<?>... groups) throws javax.validation.ValidationException
Description copied from interface:GwtSpecificValidatorValidates all constraints placed on the property ofobjectnamedpropertyName.- Specified by:
validatePropertyin interfaceGwtSpecificValidator<G>- Type Parameters:
T- the type of the RootBean for this validation context- Parameters:
context- The gwt validation contextobject- object to validatepropertyName- property to validate (ie field and getter constraints)groups- group or list of groups targeted for validation (default toDefault)- Returns:
- constraint violations or an empty Set if none
- Throws:
javax.validation.ValidationException- if a non recoverable error happens during the validation process
-
validateValue
public <T> Set<javax.validation.ConstraintViolation<T>> validateValue(GwtValidationContext<T> context, Class<G> beanType, String propertyName, Object value, Class<?>... groups) throws javax.validation.ValidationException
Description copied from interface:GwtSpecificValidatorValidates all constraints placed on the property namedpropertyNameof the classbeanTypewhere the property value isvalue.ConstraintViolationobjects return null forConstraintViolation.getRootBean()andConstraintViolation.getLeafBean()- Specified by:
validateValuein interfaceGwtSpecificValidator<G>- Type Parameters:
T- the type of the RootBean for this validation context- Parameters:
context- The gwt validation contextbeanType- the bean typepropertyName- property to validatevalue- property value to validategroups- group or list of groups targeted for validation (default toDefault)- Returns:
- constraint violations or an empty Set if none
- Throws:
javax.validation.ValidationException- if a non recoverable error happens during the validation process
-
addSingleViolation
protected <V,T,A extends Annotation> void addSingleViolation(GwtValidationContext<T> context, Set<javax.validation.ConstraintViolation<T>> violations, G object, V value, ConstraintDescriptorImpl<A> constraintDescriptor)
-
-