public class APIError extends JSONParsable
Constructor and Description |
---|
APIError()
Empty Constructor
|
APIError(org.springframework.http.HttpStatus status,
java.lang.String message,
java.util.List<java.lang.String> errors)
Constructor when having multiple errors
|
APIError(org.springframework.http.HttpStatus status,
java.lang.String message,
java.lang.String error)
Constructor when having one errors
|
APIError(javax.json.JsonObject jsonObject)
JSON Parseable constructor
|
Modifier and Type | Method and Description |
---|---|
void |
convertToJson(javax.json.JsonObjectBuilder jsonObjectBuilder)
Method that should set the objects property to Json representation.
|
java.util.List<java.lang.String> |
getErrors() |
java.lang.String |
getMessage() |
TokenException.Reason |
getReason() |
org.springframework.http.HttpStatus |
getStatus() |
void |
parseJson(javax.json.JsonObject jsonObject)
Method to read all properties from a JsonObject into this value object.
|
void |
setErrors(java.util.List<java.lang.String> errors) |
void |
setMessage(java.lang.String message) |
void |
setReason(TokenException.Reason reason) |
void |
setStatus(org.springframework.http.HttpStatus status) |
java.lang.String |
toString()
Converts data content to pretty printed Json string.
|
add, addB58, addNotRequired, addNotRequiredB58, getBoolean, getBooleanIfSet, getByteArrayFromB58, getByteArrayFromB58IfSet, getByteArrayFromB64, getByteArrayFromB64IfSet, getByteArrayFromHex, getByteArrayFromHexIfSet, getDate, getDateIfSet, getDouble, getDoubleIfSet, getInt, getIntIfSet, getJsonArray, getJsonArrayIfSet, getJsonObject, getJsonObjectIfSet, getLong, getLongIfSet, getString, getStringIfSet, toJson, toJsonAsString
public APIError()
public APIError(org.springframework.http.HttpStatus status, java.lang.String message, java.util.List<java.lang.String> errors)
status
- the HTTP status codemessage
- the error message associated with exceptionerrors
- List of constructed error messagespublic APIError(org.springframework.http.HttpStatus status, java.lang.String message, java.lang.String error)
status
- the HTTP status codemessage
- the error message associated with exceptionerror
- Constructed error messagespublic APIError(javax.json.JsonObject jsonObject) throws javax.json.JsonException
jsonObject
- the json object to parsejavax.json.JsonException
public org.springframework.http.HttpStatus getStatus()
public java.lang.String getMessage()
public java.util.List<java.lang.String> getErrors()
public void setStatus(org.springframework.http.HttpStatus status)
status
- the HTTP status codepublic void setMessage(java.lang.String message)
message
- the error message associated with exceptionpublic void setErrors(java.util.List<java.lang.String> errors)
errors
- Constructed error messagespublic TokenException.Reason getReason()
public void setReason(TokenException.Reason reason)
reason
- if error is related to JWT token the reason is specified
otherwise null.public void convertToJson(javax.json.JsonObjectBuilder jsonObjectBuilder) throws javax.json.JsonException
convertToJson
in class JSONParsable
jsonObjectBuilder
- the json object build to use to set key/values in jsonjavax.json.JsonException
- if problems occurred converting object to JSON.public java.lang.String toString()
JSONParsable
toString
in class JSONParsable
public void parseJson(javax.json.JsonObject jsonObject) throws javax.json.JsonException
parseJson
in class JSONParsable
jsonObject
- the json object to read key and values from and set object properties.javax.json.JsonException
- if problems occurred converting object from JSON.