checkers.source
Class Result

java.lang.Object
  extended by checkers.source.Result

@DefaultQualifier(value="checkers.nullness.quals.NonNull")
public final class Result
extends Object

Represents the outcome of a typechecking operation (success, warning, or failure, plus a list of explanatory messages). Results created during typechecking can be reported using SourceChecker.report(checkers.source.Result, java.lang.Object), which ultimately delivers an error or warning message via the JSR 199 compiler interface.

See Also:
SourceChecker.report(checkers.source.Result, java.lang.Object)

Nested Class Summary
static class Result.DiagMessage
          A class that represents the diangosis messages.
 
Field Summary
static Result SUCCESS
          The success result.
 
Method Summary
static Result failure(String messageKey, Object... args)
          Creates a new failure result with the given message key.
 List<Result.DiagMessage> getDiagMessages()
           
 List<String> getMessageKeys()
           
 boolean isFailure()
           
 boolean isSuccess()
           
 boolean isWarning()
           
 Result merge(Result r)
          Merges two results into one.
 String toString()
           
static Result warning(String messageKey, Object... args)
          Creates a new warning result with the given message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

SUCCESS

public static final Result SUCCESS
The success result.

Method Detail

failure

public static Result failure(String messageKey,
                             Object... args)
Creates a new failure result with the given message key.

Parameters:
messageKey - the key representing the reason for failure
args - optional arguments to be included in the message
Returns:
the failure result

warning

public static Result warning(String messageKey,
                             Object... args)
Creates a new warning result with the given message.

Parameters:
messageKey - the key for the warning message
args - optional arguments to be included in the message
Returns:
the warning result

merge

public Result merge(Result r)
Merges two results into one.

Parameters:
r - the result to merge with this result
Returns:
a result that is the success result if both this and r are success results, or a result that has the more significant type (failure > warning > success) and the message keys of both this result and r

isSuccess

public boolean isSuccess()
Returns:
true if the result is success (not a failure or warning)

isFailure

public boolean isFailure()
Returns:
true if the result is a failure

isWarning

public boolean isWarning()
Returns:
true if the result is a warning

getMessageKeys

public List<String> getMessageKeys()
Returns:
the message keys associated with the result

getDiagMessages

public List<Result.DiagMessage> getDiagMessages()
Returns:
an unmodifiable list of the message pairs

toString

public String toString()
Overrides:
toString in class Object