org.netbeans.validation.api
Class Problem

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

public final class Problem
extends java.lang.Object
implements java.lang.Comparable<Problem>

Represents a problem produced by a validator.

Author:
Tim Boudreau

Constructor Summary
Problem(java.lang.String message, Severity severity)
          Create a new problem with the given message and severity
 
Method Summary
 int compareTo(Problem o)
          Compare, such that most severe Problems will appear last, least first
 boolean equals(java.lang.Object o)
           
 java.lang.String getMessage()
          Get the localized, human-readable description of the problem
 int hashCode()
           
 boolean isFatal()
          Convenience method to determine if this problem is of Severity.FATAL severity
 boolean isWorseThan(Problem other)
          Determine if this problem is more severe than another
 Severity severity()
          Get the severity of this problem.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Problem

public Problem(java.lang.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 Detail

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

isWorseThan

public boolean isWorseThan(Problem other)
Determine if this problem is more severe than another

Parameters:
other - The other problem
Returns:
true if compareTo(other) < 0;

isFatal

public boolean isFatal()
Convenience method to determine if this problem is of Severity.FATAL severity

Returns:
true if severity() == Severity.FATAL

getMessage

public java.lang.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 last, least first

Specified by:
compareTo in interface java.lang.Comparable<Problem>
Parameters:
o -
Returns:
the difference in severity as an integer

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object