anl.aida.formula
Class ValidationResult

java.lang.Object
  extended by anl.aida.formula.ValidationResult

public class ValidationResult
extends java.lang.Object

Encapsulates the result of validating a Formula.

Version:
$Revision$ $Date$

Nested Class Summary
static class ValidationResult.Status
           
 
Field Summary
private  IllegalFormulaException ex
           
private  java.lang.String message
           
private  java.util.Map<java.lang.String,java.lang.Object> props
           
private  ValidationResult.Status status
           
private  java.util.List<FormulaVariable> variables
           
 
Constructor Summary
private ValidationResult(IllegalFormulaException ex, ValidationResult.Status status)
           
private ValidationResult(java.lang.String message, ValidationResult.Status status)
           
 
Method Summary
static ValidationResult fail(IllegalFormulaException ex)
          Creates a failed result using the specified exception.
static ValidationResult fail(java.lang.String message)
          Creates a failed result.
 IllegalFormulaException getException()
          Gets the exception if any associated with the status.
 java.lang.String getMessage()
          Gets the message explaining the status.
 java.lang.Object getProperty(java.lang.String name)
          Gets an arbitrary property from the result.
 ValidationResult.Status getStatus()
          Gets the status of the result.
 java.util.List<FormulaVariable> getVariables()
          Gets the variables in the formula.
static ValidationResult pass()
          Creates a passing result.
 void putProperty(java.lang.String name, java.lang.Object prop)
          Puts a property into this result.
(package private)  void setVariables(java.util.List<FormulaVariable> variables)
           
static ValidationResult warn(IllegalFormulaException ex)
          Creates a warning result using the specified exception.
static ValidationResult warn(java.lang.String message)
          Creates a warning result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

status

private ValidationResult.Status status

message

private java.lang.String message

ex

private IllegalFormulaException ex

variables

private java.util.List<FormulaVariable> variables

props

private java.util.Map<java.lang.String,java.lang.Object> props
Constructor Detail

ValidationResult

private ValidationResult(IllegalFormulaException ex,
                         ValidationResult.Status status)

ValidationResult

private ValidationResult(java.lang.String message,
                         ValidationResult.Status status)
Method Detail

fail

public static ValidationResult fail(IllegalFormulaException ex)
Creates a failed result using the specified exception.

Parameters:
ex - the exception containing the details of the failure.
Returns:
a failed result using the specified exception.

warn

public static ValidationResult warn(IllegalFormulaException ex)
Creates a warning result using the specified exception.

Parameters:
ex - the exception containing the details of the warning.
Returns:
a warning result using the specified exception.

fail

public static ValidationResult fail(java.lang.String message)
Creates a failed result.

Parameters:
message - contains the details of the warning.
Returns:
a failed result.

pass

public static ValidationResult pass()
Creates a passing result.

Returns:
a passing result.

warn

public static ValidationResult warn(java.lang.String message)
Creates a warning result.

Parameters:
message - contains the details of the warning.
Returns:
a warning result.

getVariables

public java.util.List<FormulaVariable> getVariables()
Gets the variables in the formula. This will return an empty list if the validation is not successful.

Returns:
the variables in the formula or an empty list if the validation is not successful.

setVariables

void setVariables(java.util.List<FormulaVariable> variables)

getStatus

public ValidationResult.Status getStatus()
Gets the status of the result.

Returns:
the status of the result.

getMessage

public java.lang.String getMessage()
Gets the message explaining the status.

Returns:
the message explaining the status.

getException

public IllegalFormulaException getException()
Gets the exception if any associated with the status.

Returns:
the exception if any associated with the status. May return null if there is no exception (e.g. in a passing result).

getProperty

public java.lang.Object getProperty(java.lang.String name)
Gets an arbitrary property from the result.

Returns:
an arbitrary property from the result.

putProperty

public void putProperty(java.lang.String name,
                        java.lang.Object prop)
Puts a property into this result.

Parameters:
name - the name of the property
prop - the value of the property