Class CommandValidator.ValidationResult
java.lang.Object
com.ultikits.ultitools.abstracts.command.validation.CommandValidator.ValidationResult
- Enclosing interface:
CommandValidator
Result of a validation operation.
- Since:
- 6.2.0
- Version:
- 2.0.0
- Author:
- wisdomme
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateValidationResult(boolean valid, String errorMessage, String errorKey) privateValidationResult(boolean valid, String errorMessage, String errorKey, Text errorText) -
Method Summary
Modifier and TypeMethodDescriptionCreates a failure rendered in the eventual recipient's language.Creates 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.Returns deferred text, or null for success and legacy string failures.booleanisValid()Checks if the validation was successful.success()Creates a successful validation result.
-
Field Details
-
valid
private final boolean valid -
errorMessage
-
errorKey
-
errorText
-
-
Constructor Details
-
ValidationResult
-
ValidationResult
-
-
Method Details
-
failure
Creates a failure rendered in the eventual recipient's language.- Parameters:
message- deferred error texterrorKey- diagnostic key, retained independently of the text- Returns:
- a failure whose
getErrorMessage()is null - Since:
- 7.0.0
-
getErrorText
Returns deferred text, or null for success and legacy string failures.- Returns:
- deferred error text
- Since:
- 7.0.0
-
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
-
getErrorKey
Gets the i18n key for the error message.- Returns:
- the error key, or null if not set
-