public class ConstraintViolationImpl<T> extends Object implements HibernateConstraintViolation<T>, Serializable
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o)
IMPORTANT - some behaviour of Validator depends on the correct implementation of this equals method! (HF)
expressionVariables and dynamicPayload are not taken into account for equality. |
static <T> ConstraintViolation<T> |
forBeanValidation(String messageTemplate,
Map<String,Object> expressionVariables,
String interpolatedMessage,
Class<T> rootBeanClass,
T rootBean,
Object leafBeanInstance,
Object value,
Path propertyPath,
ConstraintDescriptor<?> constraintDescriptor,
ElementType elementType,
Object dynamicPayload) |
static <T> ConstraintViolation<T> |
forParameterValidation(String messageTemplate,
Map<String,Object> expressionVariables,
String interpolatedMessage,
Class<T> rootBeanClass,
T rootBean,
Object leafBeanInstance,
Object value,
Path propertyPath,
ConstraintDescriptor<?> constraintDescriptor,
ElementType elementType,
Object[] executableParameters,
Object dynamicPayload) |
static <T> ConstraintViolation<T> |
forReturnValueValidation(String messageTemplate,
Map<String,Object> expressionVariables,
String interpolatedMessage,
Class<T> rootBeanClass,
T rootBean,
Object leafBeanInstance,
Object value,
Path propertyPath,
ConstraintDescriptor<?> constraintDescriptor,
ElementType elementType,
Object executableReturnValue,
Object dynamicPayload) |
ConstraintDescriptor<?> |
getConstraintDescriptor()
Returns the constraint metadata reported to fail.
|
<C> C |
getDynamicPayload(Class<C> type) |
Object[] |
getExecutableParameters()
Returns an
Object[] representing the constructor or method invocation
arguments if the ConstraintViolation is returned after validating the
method or constructor parameters. |
Object |
getExecutableReturnValue()
Returns the return value of the constructor or method invocation
if the
ConstraintViolation is returned after validating the method
or constructor return value. |
Map<String,Object> |
getExpressionVariables() |
Object |
getInvalidValue()
Returns the value failing to pass the constraint.
|
Object |
getLeafBean()
Returns:
the bean instance the constraint is applied on if it is
a bean constraint
the bean instance hosting the property the constraint
is applied on if it is a property constraint or a container element constraint
hosted on a property
null when the ConstraintViolation is returned
after calling Validator.validateValue(Class, String, Object, Class[])
the object the method is executed on if it is
a method parameter, cross-parameter or return value constraint or a
container element constraint hosted on a method parameter or return value
null if it is a constructor parameter or
cross-parameter constraint or a container element constraint hosted on a
constructor parameter
the object the constructor has created if it is a
constructor return value constraint
|
String |
getMessage() |
String |
getMessageTemplate() |
Path |
getPropertyPath() |
T |
getRootBean()
Returns the root bean being validated.
|
Class<T> |
getRootBeanClass()
Returns the class of the root bean being validated.
|
int |
hashCode() |
String |
toString() |
<C> C |
unwrap(Class<C> type)
Returns an instance of the specified type allowing access to
provider-specific APIs.
|
public static <T> ConstraintViolation<T> forBeanValidation(String messageTemplate, Map<String,Object> expressionVariables, String interpolatedMessage, Class<T> rootBeanClass, T rootBean, Object leafBeanInstance, Object value, Path propertyPath, ConstraintDescriptor<?> constraintDescriptor, ElementType elementType, Object dynamicPayload)
public static <T> ConstraintViolation<T> forParameterValidation(String messageTemplate, Map<String,Object> expressionVariables, String interpolatedMessage, Class<T> rootBeanClass, T rootBean, Object leafBeanInstance, Object value, Path propertyPath, ConstraintDescriptor<?> constraintDescriptor, ElementType elementType, Object[] executableParameters, Object dynamicPayload)
public static <T> ConstraintViolation<T> forReturnValueValidation(String messageTemplate, Map<String,Object> expressionVariables, String interpolatedMessage, Class<T> rootBeanClass, T rootBean, Object leafBeanInstance, Object value, Path propertyPath, ConstraintDescriptor<?> constraintDescriptor, ElementType elementType, Object executableReturnValue, Object dynamicPayload)
public final String getMessage()
getMessage in interface ConstraintViolation<T>public final String getMessageTemplate()
getMessageTemplate in interface ConstraintViolation<T>public Map<String,Object> getExpressionVariables()
ConstraintValidatorContextImpl.addExpressionVariable(String, Object)public final T getRootBean()
ConstraintViolation
Returns null when:
ConstraintViolation is returned after calling
Validator.validateValue(Class, String, Object, Class[])ConstraintViolation is returned after validating a
constructor.getRootBean in interface ConstraintViolation<T>nullpublic final Class<T> getRootBeanClass()
ConstraintViolationgetRootBeanClass in interface ConstraintViolation<T>public final Object getLeafBean()
ConstraintViolationnull when the ConstraintViolation is returned
after calling Validator.validateValue(Class, String, Object, Class[])
null if it is a constructor parameter or
cross-parameter constraint or a container element constraint hosted on a
constructor parametergetLeafBean in interface ConstraintViolation<T>public final Object getInvalidValue()
ConstraintViolationObject[] representing
the method invocation arguments is returned.getInvalidValue in interface ConstraintViolation<T>public final Path getPropertyPath()
getPropertyPath in interface ConstraintViolation<T>rootBeanpublic final ConstraintDescriptor<?> getConstraintDescriptor()
ConstraintViolationgetConstraintDescriptor in interface ConstraintViolation<T>public <C> C unwrap(Class<C> type)
ConstraintViolationValidationException is thrown.unwrap in interface ConstraintViolation<T>C - the type of the object to be returnedtype - the class of the object to be returnedpublic Object[] getExecutableParameters()
ConstraintViolationObject[] representing the constructor or method invocation
arguments if the ConstraintViolation is returned after validating the
method or constructor parameters.
Returns null otherwise.getExecutableParameters in interface ConstraintViolation<T>nullpublic Object getExecutableReturnValue()
ConstraintViolationConstraintViolation is returned after validating the method
or constructor return value.
Returns null if the method has no return value.
Returns null otherwise.
getExecutableReturnValue in interface ConstraintViolation<T>nullpublic <C> C getDynamicPayload(Class<C> type)
getDynamicPayload in interface HibernateConstraintViolation<T>type - The type of payload to retrieveHibernateConstraintValidatorContext.withDynamicPayload(Object) or null if no constraint payload
if the given type has been set.public boolean equals(Object o)
expressionVariables and dynamicPayload are not taken into account for equality. These
variables solely enrich the actual Constraint Violation with additional information e.g how we actually
got to this CV.Copyright © 2018 JBoss by Red Hat. All rights reserved.