Class Result


  • public final class Result
    extends Object
    A Result represents the result of a validation operation: either a success or a failure (with an associated description).
    • Method Detail

      • success

        public static Result success()
        Returns a Result representing validation success.
        Returns:
        a successful result.
      • failure

        public static Result failure​(String description)
        Returns a Result representing validation failure.
        Parameters:
        description - The description of this failure, not null.
        Returns:
        a failed result.
      • isSuccess

        public boolean isSuccess()
        Returns true if this Result is a success, false otherwise.
        Returns:
        true if this Result is a success, false otherwise.
      • isFailure

        public boolean isFailure()
        Returns true if this Result is a failure, false otherwise.
        Returns:
        true if this Result is a failure, false otherwise.
      • getDescription

        public String getDescription()
        Returns the failure description (null if this is a success).
        Returns:
        the failure description (null if this is a success).
      • asPromise

        public Promise<Result,​NeverThrowsException> asPromise()
        Returns a new completed promise wrapping this result.
        Returns:
        a new completed promise wrapping this result.