public final class JsonCustomResponseFormat extends Object implements IJsonResponseFormat
Class which encapsulates behavior for the custom JSON response format. Note that this class is immutable; to change the containing JSON, a new class needs to be instantiated.
Constructor and Description |
---|
JsonCustomResponseFormat(String json)
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
com.fasterxml.jackson.databind.JsonNode |
format()
Formats the JSON according to the specified implementing format.
|
boolean |
isFormatted()
Checks if the JSON is formatted as the specified format.
|
<T> List<T> |
toListOf(Class<T> clazz)
Converts the JSON string into a list of the specified class.
|
String |
toString() |
public JsonCustomResponseFormat(String json)
Default constructor.
json
- the json to formatpublic com.fasterxml.jackson.databind.JsonNode format()
IJsonResponseFormat
Formats the JSON according to the specified implementing format.
format
in interface IJsonResponseFormat
JsonNode
public boolean isFormatted()
IJsonResponseFormat
Checks if the JSON is formatted as the specified format.
isFormatted
in interface IJsonResponseFormat
public <T> List<T> toListOf(Class<T> clazz)
Converts the JSON string into a list of the specified class.
T
- the data type of the listclazz
- the class to convert each JSON entry toCopyright © 2016. All rights reserved.