Class ValidationResult

java.lang.Object
com.atlassian.sal.api.validate.ValidationResult

@PublicApi public class ValidationResult extends Object
The outcome of a validation check.
Since:
3.0
  • Method Details

    • valid

      public static ValidationResult valid()
    • withErrorMessages

      public static ValidationResult withErrorMessages(@Nonnull Iterable<String> errorMessages)
    • withWarningMessages

      public static ValidationResult withWarningMessages(@Nonnull Iterable<String> warningMessages)
    • withErrorAndWarningMessages

      public static ValidationResult withErrorAndWarningMessages(@Nonnull Iterable<String> errorMessages, @Nonnull Iterable<String> warningMessages)
    • isValid

      public boolean isValid()
      Return true if the validation passed, false if there were errors. (Note warnings do not cause this method to return false).
      Returns:
      true if the validation passed, false if there were errors.
      See Also:
    • hasErrors

      public boolean hasErrors()
      Return true if the validation added error messages.
      Returns:
      true if the validation failed with error messages.
    • hasWarnings

      public boolean hasWarnings()
      Return true if the validation added warning messages.
      Returns:
      true if the validation failed with warning messages.
    • getErrorMessages

      @Nonnull public Iterable<String> getErrorMessages()
      Returns error messages.

      These should normally be localised to the end user's locale. This will never be null, but may be empty.

      Returns:
      validation error messages, could be empty but not null.
    • getWarningMessages

      @Nonnull public Iterable<String> getWarningMessages()
      Returns warnings messages.

      These should normally be localised to the end user's locale. This will never be null, but may be empty.

      Returns:
      validation warning messages, could be empty but not null.