public class ServiceErrors
extends java.lang.Object
ServiceException
or from a
BatchStatus
.
This object parses the body of a ServiceException
or the content of a BatchStatus
and gives programmatic access to the error messages embedded in the body
of the exception.Constructor and Description |
---|
ServiceErrors()
Empty constructor.
|
ServiceErrors(BatchStatus status)
Creates a ServiceErrors object corresponding
to the errors contained in
BatchStatus . |
ServiceErrors(ServiceException e)
Creates a ServiceErrors object corresponding
to the errors contained in a
ServiceException . |
Modifier and Type | Method and Description |
---|---|
void |
addError(ServiceError error)
Registers a new error.
|
void |
addErrors(BatchStatus status)
Extracts errors from a
BatchStatus . |
void |
addErrors(ServiceException e)
Extracts errors from a
ServiceException . |
java.util.List<? extends ServiceError> |
getAllErrors()
Gets all errors.
|
java.util.Collection<? extends ServiceError> |
getDataErrors()
Gets data errors, which apply to the item content, often
to one field in particular.
|
java.util.Set<? extends java.lang.String> |
getErrorFields()
Gets the set of all fields that have errors.
|
java.util.List<? extends ServiceError> |
getFieldErrors(java.lang.String field)
Gets all errors for one specific field.
|
java.util.List<? extends ServiceError> |
getRequestErrors()
Gets non-data errors, which apply to the whole request.
|
java.lang.String |
toString()
Returns a convenient text representation, for debugging.
|
public ServiceErrors(ServiceException e)
ServiceException
.e
- public ServiceErrors(BatchStatus status)
BatchStatus
.status
- public ServiceErrors()
public java.lang.String toString()
toString
in class java.lang.Object
public void addErrors(ServiceException e)
ServiceException
.e
- the ServiceException to be parsedpublic void addErrors(BatchStatus status)
BatchStatus
.status
- the BatchStatus to be parsedpublic void addError(ServiceError error)
error
- public java.util.List<? extends ServiceError> getAllErrors()
public java.util.List<? extends ServiceError> getRequestErrors()
public java.util.Collection<? extends ServiceError> getDataErrors()
public java.util.Set<? extends java.lang.String> getErrorFields()
public java.util.List<? extends ServiceError> getFieldErrors(java.lang.String field)
field
- field name, which usually comes from
getErrorFields()