Record Class ConstraintViolation<T>

java.lang.Object
java.lang.Record
io.fluxzero.sdk.tracking.handling.validation.ConstraintViolation<T>
Type Parameters:
T - root bean type
Record Components:
message - interpolated violation message
messageTemplate - original message template
propertyPath - full path to the invalid property or executable value
formattedPath - compact path used by Fluxzero's formatted ValidationException messages
invalidValue - value that failed validation
rootBean - root object that was validated
rootBeanClass - root object type
constraint - fully qualified annotation type name of the violated constraint, when available
attributes - constraint annotation attributes, excluding provider-specific descriptor objects

public record ConstraintViolation<T>(String message, String messageTemplate, String propertyPath, String formattedPath, Object invalidValue, T rootBean, Class<T> rootBeanClass, String constraint, Map<String,Object> attributes) extends Record
Structured validation failure exposed by the Fluxzero validation API.

The SDK keeps this type independent from Jakarta Validation so custom Validator implementations do not have to expose provider-specific violation objects. The default validator still records the most useful metadata: message, template, property path, invalid value, root bean, constraint type, and constraint attributes.

  • Constructor Details

  • Method Details

    • getMessage

      public String getMessage()
      Returns:
      interpolated violation message
    • getMessageTemplate

      public String getMessageTemplate()
      Returns:
      original message template
    • getPropertyPath

      public String getPropertyPath()
      Returns:
      full path to the invalid property or executable value
    • getFormattedPath

      public String getFormattedPath()
      Returns:
      compact path used by Fluxzero's formatted validation exception messages
    • getInvalidValue

      public Object getInvalidValue()
      Returns:
      value that failed validation
    • getRootBean

      public T getRootBean()
      Returns:
      root object that was validated
    • getRootBeanClass

      public Class<T> getRootBeanClass()
      Returns:
      root object type
    • getConstraint

      public String getConstraint()
      Returns:
      fully qualified annotation type name of the violated constraint, when available
    • getAttributes

      public Map<String,Object> getAttributes()
      Returns:
      constraint annotation attributes
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • message

      public String message()
      Returns the value of the message record component.
      Returns:
      the value of the message record component
    • messageTemplate

      public String messageTemplate()
      Returns the value of the messageTemplate record component.
      Returns:
      the value of the messageTemplate record component
    • propertyPath

      public String propertyPath()
      Returns the value of the propertyPath record component.
      Returns:
      the value of the propertyPath record component
    • formattedPath

      public String formattedPath()
      Returns the value of the formattedPath record component.
      Returns:
      the value of the formattedPath record component
    • invalidValue

      public Object invalidValue()
      Returns the value of the invalidValue record component.
      Returns:
      the value of the invalidValue record component
    • rootBean

      public T rootBean()
      Returns the value of the rootBean record component.
      Returns:
      the value of the rootBean record component
    • rootBeanClass

      public Class<T> rootBeanClass()
      Returns the value of the rootBeanClass record component.
      Returns:
      the value of the rootBeanClass record component
    • constraint

      public String constraint()
      Returns the value of the constraint record component.
      Returns:
      the value of the constraint record component
    • attributes

      public Map<String,Object> attributes()
      Returns the value of the attributes record component.
      Returns:
      the value of the attributes record component