Class ValidationError
java.lang.Object
tech.guilhermekaua.spigotboot.core.validation.ValidationError
Represents a validation error for a field.
-
Constructor Summary
ConstructorsConstructorDescriptionValidationError(@NotNull PropertyPath path, @NotNull String fieldName, @Nullable Object invalidValue, @NotNull String message, boolean failFast, @Nullable String suggestedFix) Creates a new validation error. -
Method Summary
Modifier and TypeMethodDescription@NotNull Stringformat()Formats this error for display.@NotNull StringGets the field name.@Nullable ObjectGets the invalid value.@NotNull StringGets the error message.@NotNull PropertyPathgetPath()Gets the property path to the invalid value.@Nullable StringGets the suggested fix.booleanChecks if this error should fail fast.toString()
-
Constructor Details
-
ValidationError
public ValidationError(@NotNull @NotNull PropertyPath path, @NotNull @NotNull String fieldName, @Nullable @Nullable Object invalidValue, @NotNull @NotNull String message, boolean failFast, @Nullable @Nullable String suggestedFix) Creates a new validation error.- Parameters:
path- the property path to the invalid valuefieldName- the field nameinvalidValue- the invalid valuemessage- the error messagefailFast- whether this error should prevent plugin loadingsuggestedFix- an optional suggested fix
-
-
Method Details
-
getPath
Gets the property path to the invalid value.- Returns:
- the property path
-
getFieldName
Gets the field name.- Returns:
- the field name
-
getInvalidValue
Gets the invalid value.- Returns:
- the invalid value
-
getMessage
Gets the error message.- Returns:
- the error message
-
isFailFast
public boolean isFailFast()Checks if this error should fail fast.- Returns:
- true if fail fast
-
getSuggestedFix
Gets the suggested fix.- Returns:
- the suggested fix, or null
-
format
Formats this error for display.- Returns:
- the formatted error message
-
toString
-