com.isomorphic.util
Class ErrorReport

com.isomorphic.util.ErrorReport

public class ErrorReport

Encapsulates a per-record set of validation errors.

See Also:
Serialized Form

Constructor Summary
ErrorReport()
          Constructs an empty ErrorReport
 
Method Summary
 void addError(java.lang.String fieldName, ErrorMessage error)
          Add a validation error for a field.
 void addError(java.lang.String fieldName, java.lang.String message)
          Convenience method - creates an ErrorMessage from the passed params and calls addError(fieldName, error).
 void addError(java.lang.String fieldName, java.lang.String message, java.lang.String suggestedValue)
          Convenience method - creates an ErrorMessage from the passed params and calls addError(fieldName, error).
 java.util.List getErrors(java.lang.String fieldName)
          Returns the list of validation errors (ErrorMessages) for a given field.
 

Constructor Detail

ErrorReport

public ErrorReport()
Constructs an empty ErrorReport

Method Detail

addError

public void addError(java.lang.String fieldName,
                     java.lang.String message)
Convenience method - creates an ErrorMessage from the passed params and calls addError(fieldName, error).

Parameters:
fieldName - fieldName for which to add the error
message - set on created ErrorMessage

addError

public void addError(java.lang.String fieldName,
                     java.lang.String message,
                     java.lang.String suggestedValue)
Convenience method - creates an ErrorMessage from the passed params and calls addError(fieldName, error).

Parameters:
fieldName - fieldName for which to add the error
message - set on created ErrorMessage
suggestedValue - set on created ErrorMessage

addError

public void addError(java.lang.String fieldName,
                     ErrorMessage error)
Add a validation error for a field.

Parameters:
fieldName - fieldName for which to add the error
error - the error

getErrors

public java.util.List getErrors(java.lang.String fieldName)
Returns the list of validation errors (ErrorMessages) for a given field.

Parameters:
fieldName - name of the field for which to return validation errors
Returns:
List of ErrorMessage objects, one for each error
See Also:
ErrorMessage