Class ConstraintViolationImpl<T>

  • All Implemented Interfaces:
    jakarta.validation.ConstraintViolation<T>, Serializable

    public class ConstraintViolationImpl<T>
    extends Object
    implements jakarta.validation.ConstraintViolation<T>, Serializable
    Description: Describe a constraint validation defect.
    From rootBean and propertyPath, it is possible to rebuild the context of the failure
    See Also:
    Serialized Form
    • Constructor Detail

      • ConstraintViolationImpl

        public ConstraintViolationImpl​(String messageTemplate,
                                       String message,
                                       T rootBean,
                                       Object leafBean,
                                       jakarta.validation.Path propertyPath,
                                       Object value,
                                       jakarta.validation.metadata.ConstraintDescriptor<?> constraintDescriptor,
                                       Class<T> rootBeanClass,
                                       ElementType elementType,
                                       Object returnValue,
                                       Object[] parameters)
        Create a new ConstraintViolationImpl instance.
        Parameters:
        messageTemplate - - message reason (raw message)
        message - - interpolated message (locale specific)
        rootBean -
        leafBean -
        propertyPath -
        value -
        constraintDescriptor -
        rootBeanClass -
        elementType -
        returnValue -
        parameters -
    • Method Detail

      • getMessage

        public String getMessage()
        former name getInterpolatedMessage()
        Specified by:
        getMessage in interface jakarta.validation.ConstraintViolation<T>
        Returns:
        The interpolated error message for this constraint violation.
      • getMessageTemplate

        public String getMessageTemplate()
        Specified by:
        getMessageTemplate in interface jakarta.validation.ConstraintViolation<T>
      • getRootBean

        public T getRootBean()
        Specified by:
        getRootBean in interface jakarta.validation.ConstraintViolation<T>
        Returns:
        Root bean being validated
      • getRootBeanClass

        public Class<T> getRootBeanClass()
        Specified by:
        getRootBeanClass in interface jakarta.validation.ConstraintViolation<T>
      • getLeafBean

        public Object getLeafBean()
        Specified by:
        getLeafBean in interface jakarta.validation.ConstraintViolation<T>
      • getExecutableParameters

        public Object[] getExecutableParameters()
        Specified by:
        getExecutableParameters in interface jakarta.validation.ConstraintViolation<T>
      • getExecutableReturnValue

        public Object getExecutableReturnValue()
        Specified by:
        getExecutableReturnValue in interface jakarta.validation.ConstraintViolation<T>
      • getInvalidValue

        public Object getInvalidValue()
        Specified by:
        getInvalidValue in interface jakarta.validation.ConstraintViolation<T>
        Returns:
        The value failing to pass the constraint
      • getPropertyPath

        public jakarta.validation.Path getPropertyPath()
        Specified by:
        getPropertyPath in interface jakarta.validation.ConstraintViolation<T>
        Returns:
        the property path to the value from rootBean Null if the value is the rootBean itself
      • getConstraintDescriptor

        public jakarta.validation.metadata.ConstraintDescriptor<?> getConstraintDescriptor()
        Specified by:
        getConstraintDescriptor in interface jakarta.validation.ConstraintViolation<T>
      • unwrap

        public <U> U unwrap​(Class<U> type)
        Specified by:
        unwrap in interface jakarta.validation.ConstraintViolation<T>
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object