Class Problem

java.lang.Object
org.netbeans.validation.api.Problem
All Implemented Interfaces:
Comparable<Problem>

public final class Problem extends Object implements Comparable<Problem>
Represents a problem produced by a validator.
Author:
Tim Boudreau
  • Constructor Details

    • Problem

      public Problem(String message, Severity severity)
      Create a new problem with the given message and severity
      Parameters:
      message - A localized, human readable message
      severity - The severity
  • Method Details

    • severity

      public Severity severity()
      Get the Severity of this Problem. The severity indicates whether the user should be blocked from further action until the problem is corrected, or if continuing with a warning is reasonable. It also determines the warning icon which can be displayed to the user.
      Returns:
      The severity of the Problem
    • worst

      public static Problem worst(Problem p1, Problem p2)
      Determine which Problem is more severe. Uses compareTo().
      Parameters:
      p1 - p2 the two Problems to compare. Any of them (or both) may be null.
      Returns:
      p1 if p1 is worse
    • isFatal

      public boolean isFatal()
      Convenience method to determine if this problem is of Severity.FATAL severity
      Returns:
      true if severity() == Severity.FATAL
    • getMessage

      public String getMessage()
      Get the localized, human-readable description of the problem
      Returns:
      The message
    • compareTo

      public int compareTo(Problem o)
      Compare, such that most severe Problems will appear first, least last
      Specified by:
      compareTo in interface Comparable<Problem>
      Parameters:
      o -
      Returns:
      the difference in severity as an integer
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object