Class NestedErrorCollection
java.lang.Object
com.codebarrel.automation.api.validation.NestedErrorCollection
- All Implemented Interfaces:
ErrorCollection
This error collection is used when adding errors to nested elements. When adding an error for a "field", it will treat
the "field" as a child component of parentContext and nest it as a map under the parentContext.toErrorId
-
Constructor Summary
ConstructorsConstructorDescriptionNestedErrorCollection(ComponentContext parentContext, ErrorCollection delegate) NestedErrorCollection(String parentErrorId, ErrorCollection delegate) -
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 JSONOnly returns errors nested under the given parent error idintbooleanDoes this contain any field errors or messagesvoidsetStatus(int status) Sets the HTTP status code for the error
-
Constructor Details
-
NestedErrorCollection
-
NestedErrorCollection
-
-
Method Details
-
addError
Description copied from interface:ErrorCollectionAdds to the error map. This over-writes for any duplicate key- Specified by:
addErrorin interfaceErrorCollection
-
addErrors
Description copied from interface:ErrorCollectionAppends 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- Specified by:
addErrorsin interfaceErrorCollection
-
addErrors
- Specified by:
addErrorsin interfaceErrorCollection
-
addErrorMessage
Description copied from interface:ErrorCollectionAppends error message- Specified by:
addErrorMessagein interfaceErrorCollection
-
addErrorMessages
- Specified by:
addErrorMessagesin interfaceErrorCollection
-
addWarningMessages
- Specified by:
addWarningMessagesin interfaceErrorCollection
-
setStatus
public void setStatus(int status) Description copied from interface:ErrorCollectionSets the HTTP status code for the error- Specified by:
setStatusin interfaceErrorCollection
-
hasAnyErrors
public boolean hasAnyErrors()Description copied from interface:ErrorCollectionDoes this contain any field errors or messages- Specified by:
hasAnyErrorsin interfaceErrorCollection
-
getErrorMessages
- Specified by:
getErrorMessagesin interfaceErrorCollection
-
getWarningMessages
- Specified by:
getWarningMessagesin interfaceErrorCollection
-
getErrors
Only returns errors nested under the given parent error id- Specified by:
getErrorsin interfaceErrorCollection- Returns:
- Nested error map
-
getErrorMessage
Description copied from interface:ErrorCollectionReturns an error message, this is only set through JSON- Specified by:
getErrorMessagein interfaceErrorCollection
-
getStatus
public int getStatus()- Specified by:
getStatusin interfaceErrorCollection
-