Package com.codebarrel.api
Interface ErrorCollection
- All Known Implementing Classes:
ErrorCollectionImpl
,NestedErrorCollection
public interface ErrorCollection
Interface for handling errors
-
Method Summary
Modifier and TypeMethodDescriptionAdds to the error map.addErrorMessage
(String errorMessage) Appends error messageaddErrorMessages
(Collection<String> messages) addErrors
(ErrorCollection errorCollection) Appends error messages and add the error map.addWarningMessages
(Collection<String> messages) Returns an error message, this is only set through JSONError key/values on the collectionint
boolean
Does this contain any field errors or messagesstatic ErrorCollection
void
setStatus
(int status) Sets the HTTP status code for the error
-
Method Details
-
hasAnyErrors
boolean hasAnyErrors()Does this contain any field errors or messages -
addErrors
Appends error messages and add the error map. This over-writes the errors map for any duplicate key Warning: This method does not currently copy across error status, ensure that it set properly before using this -
addErrors
-
addError
Adds to the error map. This over-writes for any duplicate key -
getErrors
Error key/values on the collection- Returns:
- Unmodified map of errors. Use addError for any mutations
-
addErrorMessage
Appends error message -
addErrorMessages
-
addWarningMessages
-
getErrorMessages
-
getWarningMessages
-
getErrorMessage
String getErrorMessage()Returns an error message, this is only set through JSON -
setStatus
void setStatus(int status) Sets the HTTP status code for the error -
getStatus
int getStatus() -
newInstance
-