Class BeanValidator.SimpleContext

  • All Implemented Interfaces:
    Serializable, javax.validation.MessageInterpolator.Context
    Enclosing class:
    BeanValidator

    protected static class BeanValidator.SimpleContext
    extends Object
    implements javax.validation.MessageInterpolator.Context, Serializable
    Simple implementation of a message interpolator context that returns fixed values.
    See Also:
    Serialized Form
    • Constructor Detail

      • SimpleContext

        public SimpleContext​(Object value,
                             javax.validation.ConstraintViolation<?> violation)
        Create a simple immutable message interpolator context.
        Parameters:
        value - value being validated
        violation - ConstraintViolation corresponding to the constraint being validated
        Since:
        7.7.41
      • SimpleContext

        public SimpleContext​(Object value,
                             javax.validation.metadata.ConstraintDescriptor<?> descriptor)
        Create a simple immutable message interpolator context.
        Parameters:
        value - value being validated
        descriptor - ConstraintDescriptor corresponding to the constraint being validated
    • Method Detail

      • getConstraintDescriptor

        public javax.validation.metadata.ConstraintDescriptor<?> getConstraintDescriptor()
        Specified by:
        getConstraintDescriptor in interface javax.validation.MessageInterpolator.Context
      • getConstaintViolation

        public javax.validation.ConstraintViolation<?> getConstaintViolation()
        Returns the ConstraintViolation that was used to create this SimpleContext. Returns null if this SimpleContext was created using a ConstraintDescriptor.
        Returns:
        the ConstraintViolation that was used during construction, or null.
        Since:
        7.7.41
      • getValidatedValue

        public Object getValidatedValue()
        Specified by:
        getValidatedValue in interface javax.validation.MessageInterpolator.Context
      • unwrap

        public <T> T unwrap​(Class<T> type)