Package org.confng.validation
Class ValidationError
- java.lang.Object
-
- org.confng.validation.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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classValidationError.ConstraintTypeTypes of validation constraints that can be violated.
-
Constructor Summary
Constructors Constructor Description ValidationError(String key, ValidationError.ConstraintType constraintType, String message, String actualValue, boolean sensitive)Creates a new ValidationError.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetActualValue()Gets the actual value that failed validation.ValidationError.ConstraintTypegetConstraintType()Gets the type of constraint that was violated.StringgetKey()Gets the configuration key that failed validation.StringgetMessage()Gets the error message.booleanisSensitive()Checks if the value is sensitive.StringtoString()
-
-
-
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 validationconstraintType- the type of constraint that was violatedmessage- the error messageactualValue- 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
-
-