public final class Validators extends Object
Modifier and Type | Field and Description |
---|---|
static String |
BEAN_VALIDATION_AVAILABLE |
Modifier and Type | Method and Description |
---|---|
static Validator |
getBeanValidator()
Returns the bean validator which is aware of the JSF locale.
|
static ValidatorFactory |
getBeanValidatorFactory()
Returns the default bean validator factory.
|
static List<Path.Node> |
getPropertyNodes(ConstraintViolation<?> violation)
Returns a list of property path nodes from the given constraint violation.
|
static boolean |
isBeanValidationAvailable()
Returns
true if Bean Validation is available. |
static Object |
resolveViolatedBase(Object bean,
ConstraintViolation<?> violation)
Resolve violated base from given bean based on given violation.
|
static String |
resolveViolatedProperty(Object bean,
ConstraintViolation<?> violation)
Resolve violated property from given bean based on given violation.
|
static Set<ConstraintViolation<?>> |
validateBean(Object bean,
Class<?>... groups)
Validate given bean on given group classes.
|
static Set<ConstraintViolation<?>> |
validateBeanProperty(Class<?> beanType,
String propertyName,
Object value,
Class<?>... groups)
Validate given value as if it were a property of the given bean type.
|
public static final String BEAN_VALIDATION_AVAILABLE
public static boolean isBeanValidationAvailable()
true
if Bean Validation is available. This is remembered in the application scope.true
if Bean Validation is available.public static ValidatorFactory getBeanValidatorFactory()
public static Validator getBeanValidator()
Faces.getLocale()
public static Set<ConstraintViolation<?>> validateBean(Object bean, Class<?>... groups)
bean
- Bean to be validated.groups
- Bean validation groups, if any.public static Set<ConstraintViolation<?>> validateBeanProperty(Class<?> beanType, String propertyName, Object value, Class<?>... groups)
beanType
- Type of target bean.propertyName
- Name of property on target bean.value
- Value to be validated.groups
- Bean validation groups, if any.public static Object resolveViolatedBase(Object bean, ConstraintViolation<?> violation)
bean
- Bean to resolve violated base on.violation
- Constraint violation to resolve violated base from.public static String resolveViolatedProperty(Object bean, ConstraintViolation<?> violation)
bean
- Bean to resolve violated base on.violation
- Constraint violation to resolve violated base from.public static List<Path.Node> getPropertyNodes(ConstraintViolation<?> violation)
violation
- The constraint violation to return a list of property path nodes from.Copyright © 2012–2020 OmniFaces. All rights reserved.