org.apache.bval.jsr303
Class ConstraintViolationImpl<T>

java.lang.Object
  extended by org.apache.bval.jsr303.ConstraintViolationImpl<T>
All Implemented Interfaces:
Serializable, ConstraintViolation<T>

 class ConstraintViolationImpl<T>
extends Object
implements ConstraintViolation<T>, Serializable

Description: Describe a constraint validation defect.
From rootBean and propertyPath, it is possible to rebuild the context of the failure


Constructor Summary
ConstraintViolationImpl(String messageTemplate, String message, T rootBean, Object leafBean, Path propertyPath, Object value, ConstraintDescriptor<?> constraintDescriptor, Class<T> rootBeanClass, ElementType elementType)
          Create a new ConstraintViolationImpl instance.
 
Method Summary
 boolean equals(Object obj)
           NOTE: Needed to avoid duplication in the reported violations.
 ConstraintDescriptor<?> getConstraintDescriptor()
          
 Object getInvalidValue()
          
 Object getLeafBean()
          
 String getMessage()
           former name getInterpolatedMessage()
 String getMessageTemplate()
          
 Path getPropertyPath()
          
 T getRootBean()
          
 Class<T> getRootBeanClass()
          
 int hashCode()
          
 String toString()
          
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConstraintViolationImpl

public ConstraintViolationImpl(String messageTemplate,
                               String message,
                               T rootBean,
                               Object leafBean,
                               Path propertyPath,
                               Object value,
                               ConstraintDescriptor<?> constraintDescriptor,
                               Class<T> rootBeanClass,
                               ElementType elementType)
Create a new ConstraintViolationImpl instance.

Parameters:
messageTemplate - - message reason (raw message)
message - - interpolated message (locale specific)
rootBean -
leafBean -
propertyPath -
value -
constraintDescriptor -
rootBeanClass -
elementType -
Method Detail

getMessage

public String getMessage()
former name getInterpolatedMessage()

Specified by:
getMessage in interface ConstraintViolation<T>
Returns:
The interpolated error message for this constraint violation.

getMessageTemplate

public String getMessageTemplate()

Specified by:
getMessageTemplate in interface ConstraintViolation<T>

getRootBean

public T getRootBean()

Specified by:
getRootBean in interface ConstraintViolation<T>
Returns:
Root bean being validated

getRootBeanClass

public Class<T> getRootBeanClass()

Specified by:
getRootBeanClass in interface ConstraintViolation<T>

getLeafBean

public Object getLeafBean()

Specified by:
getLeafBean in interface ConstraintViolation<T>

getInvalidValue

public Object getInvalidValue()

Specified by:
getInvalidValue in interface ConstraintViolation<T>
Returns:
The value failing to pass the constraint

getPropertyPath

public Path getPropertyPath()

Specified by:
getPropertyPath in interface ConstraintViolation<T>
Returns:
the property path to the value from rootBean Null if the value is the rootBean itself

getConstraintDescriptor

public ConstraintDescriptor<?> getConstraintDescriptor()

Specified by:
getConstraintDescriptor in interface ConstraintViolation<T>

toString

public String toString()

Overrides:
toString in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
NOTE: Needed to avoid duplication in the reported violations.

Overrides:
equals in class Object
Parameters:
obj - the reference object with which to compare.
Returns:
true if this object is the same as the obj argument; false otherwise.


Copyright © 2010-2014 The Apache Software Foundation. All Rights Reserved.