|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Validator
Validate bean instances. Implementations of this interface must be thread-safe.
Method Summary | ||
---|---|---|
BeanDescriptor |
getConstraintsForClass(java.lang.Class<?> clazz)
Return the descriptor object describing bean constraints. |
|
|
unwrap(java.lang.Class<T> type)
Return an instance of the specified type allowing access to provider-specific APIs. |
|
|
validate(T object,
java.lang.Class<?>... groups)
Validates all constraints on object . |
|
|
validateProperty(T object,
java.lang.String propertyName,
java.lang.Class<?>... groups)
Validates all constraints placed on the property of object
named propertyName . |
|
|
validateValue(java.lang.Class<T> beanType,
java.lang.String propertyName,
java.lang.Object value,
java.lang.Class<?>... groups)
Validates all constraints placed on the property named propertyName
of the class beanType would the property value be value
ConstraintViolation objects return null for
ConstraintViolation#getRootBean() and ConstraintViolation#getLeafBean() |
Method Detail |
---|
<T> java.util.Set<ConstraintViolation<T>> validate(T object, java.lang.Class<?>... groups)
object
.
object
- object to validategroups
- group or list of groups targeted for validation
(default to Default
)
java.lang.IllegalArgumentException
- if object is null
or if null is passed to the varargs groups
ValidationException
- if a non recoverable error happens
during the validation process<T> java.util.Set<ConstraintViolation<T>> validateProperty(T object, java.lang.String propertyName, java.lang.Class<?>... groups)
object
named propertyName
.
object
- object to validatepropertyName
- property to validate (ie field and getter constraints)groups
- group or list of groups targeted for validation
(default to Default
)
java.lang.IllegalArgumentException
- if object
is null,
if propertyName
null, empty or not a valid object property
or if null is passed to the varargs groups
ValidationException
- if a non recoverable error happens
during the validation process<T> java.util.Set<ConstraintViolation<T>> validateValue(java.lang.Class<T> beanType, java.lang.String propertyName, java.lang.Object value, java.lang.Class<?>... groups)
propertyName
of the class beanType
would the property value be value
ConstraintViolation
objects return null for
ConstraintViolation#getRootBean()
and ConstraintViolation#getLeafBean()
beanType
- the bean typepropertyName
- property to validatevalue
- property value to validategroups
- group or list of groups targeted for validation
(default to Default
)
java.lang.IllegalArgumentException
- if beanType
is null,
if propertyName
null, empty or not a valid object property
or if null is passed to the varargs groups
ValidationException
- if a non recoverable error happens
during the validation processBeanDescriptor getConstraintsForClass(java.lang.Class<?> clazz)
ConstraintDescriptors) are immutable.
- Parameters:
clazz
- class or interface type evaluated
- Returns:
- the bean descriptor for the specified class.
- Throws:
java.lang.IllegalArgumentException
- if clazz is null
ValidationException
- if a non recoverable error happens
during the metadata discovery or if some
constraints are invalid.
<T> T unwrap(java.lang.Class<T> type)
ValidationException
is thrown.
type
- the class of the object to be returned.
ValidationException
- if the provider does not support the call.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2009, 2010, Oracle Corporation and/or its affiliates. All Rights Reserved. Use is subject to license terms.
Generated on 4-June-2010 04:34