Class ValidationError


  • public class ValidationError
    extends Object
    Represents a single validation error for a configuration key.

    This class contains details about what validation failed and why, including the key name, the constraint that was violated, and a human-readable error message.

    Since:
    1.1.0
    Author:
    Bharat Kumar Malviya, GitHub: github.com/imBharatMalviya
    See Also:
    ValidationResult, ConfigValidator
    • Constructor Detail

      • ValidationError

        public ValidationError​(String key,
                               ValidationError.ConstraintType constraintType,
                               String message,
                               String actualValue,
                               boolean sensitive)
        Creates a new ValidationError.
        Parameters:
        key - the configuration key that failed validation
        constraintType - the type of constraint that was violated
        message - the error message
        actualValue - the actual value that failed validation (may be null)
        sensitive - whether the value is sensitive and should be masked
    • Method Detail

      • getKey

        public String getKey()
        Gets the configuration key that failed validation.
        Returns:
        the key name
      • getConstraintType

        public ValidationError.ConstraintType getConstraintType()
        Gets the type of constraint that was violated.
        Returns:
        the constraint type
      • getMessage

        public String getMessage()
        Gets the error message.
        Returns:
        the error message
      • getActualValue

        public String getActualValue()
        Gets the actual value that failed validation. Returns "***MASKED***" for sensitive values.
        Returns:
        the actual value or masked placeholder
      • isSensitive

        public boolean isSensitive()
        Checks if the value is sensitive.
        Returns:
        true if the value is sensitive