|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
@PublicApi public interface ErrorCollection
A very simple interface to collect errors. This is typically used during form validation for collecting field
validation errors (use addError(String, String)
), and general errors
(addErrorMessage(String)
) that aren't field-specific (eg. permission problems).
Nested Class Summary | |
---|---|
static class |
ErrorCollection.Reason
|
Method Summary | |
---|---|
void |
addError(String field,
String message)
Add a field-specific error message. |
void |
addError(String field,
String message,
ErrorCollection.Reason reason)
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 |
addErrorMessage(String message,
ErrorCollection.Reason reason)
Add error message relating to system state (not field-specific), and a reason. |
void |
addErrorMessages(Collection<String> errorMessages)
Append new error messages to those already collected. |
void |
addErrors(Map<String,String> errors)
Append new field-specific errors to those already collected. |
void |
addReason(ErrorCollection.Reason reason)
Add a reason why the function has not been performed. |
void |
addReasons(Set<ErrorCollection.Reason> reasons)
Add reasons why the function has not been performed. |
Collection<String> |
getErrorMessages()
Get all non field-specific error messages. |
Map<String,String> |
getErrors()
Get all field-specific errors. |
Collection<String> |
getFlushedErrorMessages()
Get error messages, then get rid of them. |
Set<ErrorCollection.Reason> |
getReasons()
A set of well known reasons why the function has not been performed. |
boolean |
hasAnyErrors()
Whether any errors (of any type - field-specific or otherwise) have been collected. |
void |
setErrorMessages(Collection<String> errorMessages)
Populate this ErrorCollection with a new set of messages (existing errors are lost). |
void |
setReasons(Set<ErrorCollection.Reason> reasons)
Set reasons why the function has not been performed. |
Method Detail |
---|
void addError(String field, String message)
field
- Field name, eg. "assignee"message
- Error message.void addError(String field, String message, ErrorCollection.Reason reason)
field
- Field name, eg. "assignee"message
- Error message.reason
- Reason for the error.void addErrorMessage(String message)
message
- Error message.void addErrorMessage(String message, ErrorCollection.Reason reason)
message
- Error message.reason
- Reason for the error.Collection<String> getErrorMessages()
void setErrorMessages(Collection<String> errorMessages)
errorMessages
- List of error message String
s.Collection<String> getFlushedErrorMessages()
Map<String,String> getErrors()
void addErrorCollection(ErrorCollection errors)
errors
- ErrorCollection whose errors/messages we obtain.void addErrorMessages(Collection<String> errorMessages)
errorMessages
- Collection of error strings.void addErrors(Map<String,String> errors)
errors
- of String: String pairs, eg. {"assignee": "Assignee is required"}boolean hasAnyErrors()
void addReasons(Set<ErrorCollection.Reason> reasons)
reasons
- a set of well known reasons why the function has not been performed.void addReason(ErrorCollection.Reason reason)
reason
- a well known reasons why the function has not been performed.void setReasons(Set<ErrorCollection.Reason> reasons)
reasons
- a set of well known reasons why the function has not been performed.Set<ErrorCollection.Reason> getReasons()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |