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. 创建带有消息和 i18n 键的失败验证结果。- 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. 获取错误消息的 i18n 键。- Returns:
- the error key, or null if not set
-