Class CommandValidator.ValidationResult
java.lang.Object
com.ultikits.ultitools.abstracts.command.validation.CommandValidator.ValidationResult
- Enclosing interface:
CommandValidator
Result of a validation operation.
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateValidationResult(boolean valid, String errorMessage, String errorKey) -
Method Summary
Modifier and TypeMethodDescriptionCreates a failed validation result with a message.Creates a failed validation result with a message and i18n key.Gets the i18n key for the error message.Gets the error message if validation failed.booleanisValid()Checks if the validation was successful.success()Creates a successful validation result.
-
Field Details
-
valid
private final boolean valid -
errorMessage
-
errorKey
-
-
Constructor Details
-
ValidationResult
-
-
Method Details
-
success
Creates a successful validation result.- Returns:
- a success result
-
failure
Creates a failed validation result with a message.- Parameters:
errorMessage- the error message- Returns:
- a failure result
-
failure
Creates a failed validation result with a message and i18n key.- Parameters:
errorMessage- the error messageerrorKey- the i18n key for the error- Returns:
- a failure result
-
isValid
public boolean isValid()Checks if the validation was successful.- Returns:
- true if valid
-
getErrorMessage
Gets the error message if validation failed.- Returns:
- the error message, or null if valid
-
getErrorKey
Gets the i18n key for the error message.- Returns:
- the error key, or null if not set
-