Class CommandValidator.ValidationResult

java.lang.Object
com.ultikits.ultitools.abstracts.command.validation.CommandValidator.ValidationResult
Enclosing interface:
CommandValidator

public static final class CommandValidator.ValidationResult extends Object
Result of a validation operation.
  • Field Details

    • valid

      private final boolean valid
    • errorMessage

      private final String errorMessage
    • errorKey

      private final String errorKey
  • Constructor Details

  • Method Details

    • success

      public static CommandValidator.ValidationResult success()
      Creates a successful validation result.
      Returns:
      a success result
    • failure

      public static CommandValidator.ValidationResult failure(String errorMessage)
      Creates a failed validation result with a message.
      Parameters:
      errorMessage - the error message
      Returns:
      a failure result
    • failure

      public static CommandValidator.ValidationResult failure(String errorMessage, String errorKey)
      Creates a failed validation result with a message and i18n key.
      Parameters:
      errorMessage - the error message
      errorKey - 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

      @Nullable public String getErrorMessage()
      Gets the error message if validation failed.
      Returns:
      the error message, or null if valid
    • getErrorKey

      @Nullable public String getErrorKey()
      Gets the i18n key for the error message.
      Returns:
      the error key, or null if not set