Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.hibernate.validator
Class ClassValidator<T>

    java.lang.Object
      org.hibernate.validator.ClassValidator<T>

All Implemented Interfaces:
  Serializable

    public class ClassValidator<T>

extends Object
implements Serializable

Engine that take a bean and check every expressed annotation restrictions

Author:
  Gavin King, Emmanuel Bernard
See Also:
  Serialized Form

Constructor Summary
`` | `ClassValidator(Class<T> beanClass)` create the validator engine for this bean type
`` | `ClassValidator(Class<T> beanClass, MessageInterpolator interpolator)` create the validator engine for a particular bean class, using a custom message interpolator for message rendering on violation
`` | `ClassValidator(Class<T> beanClass, ResourceBundle resourceBundle)` create the validator engine for a particular bean class, using a resource bundle for message rendering on violation
`` | `ClassValidator(Class<T> beanClass, ResourceBundle resourceBundle, MessageInterpolator interpolator, Map<XClass,ClassValidator> childClassValidators, ReflectionManager reflectionManager)` Not a public API
`protected` | `ClassValidator(XClass beanXClass, ResourceBundle resourceBundle, MessageInterpolator userInterpolator, Map<XClass,ClassValidator> childClassValidators, ReflectionManager reflectionManager)`

Method Summary
`void` | `apply(org.hibernate.mapping.PersistentClass persistentClass)` apply the registred constraints rules on the hibernate metadata (to be applied on DB schema...)
`void` | `assertValid(T bean)`
`InvalidValue[]` | `getInvalidValues(T bean)` apply constraints on a bean instance and return all the failures.
`protected InvalidValue[]` | `getInvalidValues(T bean, Set<Object> circularityState)` apply constraints on a bean instance and return all the failures.
`InvalidValue[]` | `getInvalidValues(T bean, String propertyName)` Apply constraints of a particular property on a bean instance and return all the failures.
`InvalidValue[]` | `getPotentialInvalidValues(String propertyName, Object value)` Apply constraints of a particular property value of a bean type and return all the failures.
`String` | `getPropertyName(XMember member)`
`boolean` | `hasValidationRules()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### ClassValidator

    public ClassValidator(Class<T> beanClass)

  create the validator engine for this bean type

### ClassValidator

    public ClassValidator(Class<T> beanClass,
                          ResourceBundle resourceBundle)

  create the validator engine for a particular bean class, using a resource bundle for message rendering on violation

### ClassValidator

    public ClassValidator(Class<T> beanClass,
                          MessageInterpolator interpolator)

  create the validator engine for a particular bean class, using a custom message interpolator for message rendering on violation

### ClassValidator

    public ClassValidator(Class<T> beanClass,
                          ResourceBundle resourceBundle,
                          MessageInterpolator interpolator,
                          Map<XClass,ClassValidator> childClassValidators,
                          ReflectionManager reflectionManager)

  Not a public API

### ClassValidator

    protected ClassValidator(XClass beanXClass,
                             ResourceBundle resourceBundle,
                             MessageInterpolator userInterpolator,
                             Map<XClass,ClassValidator> childClassValidators,
                             ReflectionManager reflectionManager)

Method Detail

### hasValidationRules

    public boolean hasValidationRules()

### getInvalidValues

    public InvalidValue[] getInvalidValues(T bean)

  apply constraints on a bean instance and return all the failures. if `bean` is null, an empty array is returned

### getInvalidValues

    protected InvalidValue[] getInvalidValues(T bean,
                                              Set<Object> circularityState)

  apply constraints on a bean instance and return all the failures. if `bean` is null, an empty array is returned

### getInvalidValues

    public InvalidValue[] getInvalidValues(T bean,
                                           String propertyName)

  Apply constraints of a particular property on a bean instance and return all the failures. Note this is not recursive.

### getPotentialInvalidValues

    public InvalidValue[] getPotentialInvalidValues(String propertyName,
                                                    Object value)

  Apply constraints of a particular property value of a bean type and return all the failures. The InvalidValue objects returns return null for InvalidValue#getBean() and InvalidValue#getRootBean() Note this is not recursive.

### getPropertyName

    public String getPropertyName(XMember member)

### apply

    public void apply(org.hibernate.mapping.PersistentClass persistentClass)

  apply the registred constraints rules on the hibernate metadata (to be applied on DB schema...)

  Parameters:
    `persistentClass` - hibernate metadata

### assertValid

    public void assertValid(T bean)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD