com.atlassian.jira.util
Class SimpleErrorCollection

java.lang.Object
  extended by com.atlassian.jira.util.SimpleErrorCollection
All Implemented Interfaces:
ErrorCollection

public class SimpleErrorCollection
extends Object
implements ErrorCollection


Constructor Summary
SimpleErrorCollection()
           
 
Method Summary
 void addError(String field, String message)
          Add a field-specific error message.
 void addErrorCollection(ErrorCollection errors)
          Populate this ErrorCollection with general and field-specific errors.
 void addErrorMessage(String message)
          Add error message relating to system state (not field-specific).
 void addErrorMessages(Collection incomingMessages)
          Append new error messages to those already collected.
 void addErrors(Map incomingErrors)
          Append new field-specific errors to those already collected.
 boolean equals(Object o)
           
 Collection getErrorMessages()
          Get all non field-specific error messages.
 Map getErrors()
          Get all field-specific errors.
 Collection getFlushedErrorMessages()
          Get error messages, then get rid of them.
 boolean hasAnyErrors()
          Whether any errors (of any type - field-specific or otherwise) have been collected.
 int hashCode()
           
 void setErrorMessages(Collection errorMessages)
          Populate this ErrorCollection with a new set of messages (existing errors are lost).
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SimpleErrorCollection

public SimpleErrorCollection()
Method Detail

addError

public void addError(String field,
                     String message)
Description copied from interface: ErrorCollection
Add a field-specific error message.

Specified by:
addError in interface ErrorCollection
Parameters:
field - Field name, eg. "assignee"
message - Error message.

addErrorMessage

public void addErrorMessage(String message)
Description copied from interface: ErrorCollection
Add error message relating to system state (not field-specific).

Specified by:
addErrorMessage in interface ErrorCollection
Parameters:
message - Error message.

getErrorMessages

public Collection getErrorMessages()
Description copied from interface: ErrorCollection
Get all non field-specific error messages.

Specified by:
getErrorMessages in interface ErrorCollection
Returns:
Collection of error Strings.

setErrorMessages

public void setErrorMessages(Collection errorMessages)
Description copied from interface: ErrorCollection
Populate this ErrorCollection with a new set of messages (existing errors are lost).

Specified by:
setErrorMessages in interface ErrorCollection
Parameters:
errorMessages - List of error message Strings.

getFlushedErrorMessages

public Collection getFlushedErrorMessages()
Description copied from interface: ErrorCollection
Get error messages, then get rid of them.

Specified by:
getFlushedErrorMessages in interface ErrorCollection
Returns:
The (now cleared) error messages.

getErrors

public Map getErrors()
Description copied from interface: ErrorCollection
Get all field-specific errors.

Specified by:
getErrors in interface ErrorCollection
Returns:
Map of String: String pairs, eg. {"assignee": "Assignee is required"}

addErrorCollection

public void addErrorCollection(ErrorCollection errors)
Description copied from interface: ErrorCollection
Populate this ErrorCollection with general and field-specific errors.

Specified by:
addErrorCollection in interface ErrorCollection
Parameters:
errors - ErrorCollection whose errors/messages we obtain.

addErrorMessages

public void addErrorMessages(Collection incomingMessages)
Description copied from interface: ErrorCollection
Append new error messages to those already collected.

Specified by:
addErrorMessages in interface ErrorCollection
Parameters:
incomingMessages - Collection of error strings.

addErrors

public void addErrors(Map incomingErrors)
Description copied from interface: ErrorCollection
Append new field-specific errors to those already collected.

Specified by:
addErrors in interface ErrorCollection
Parameters:
incomingErrors - of String: String pairs, eg. {"assignee": "Assignee is required"}

hasAnyErrors

public boolean hasAnyErrors()
Description copied from interface: ErrorCollection
Whether any errors (of any type - field-specific or otherwise) have been collected.

Specified by:
hasAnyErrors in interface ErrorCollection

toString

public String toString()
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

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


Copyright © 2002-2009 Atlassian. All Rights Reserved.