Class JsonCustomResponseFormat
- java.lang.Object
-
- com.github.dannil.scbjavaclient.format.json.JsonCustomResponseFormat
-
public final class JsonCustomResponseFormat extends Object
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.
- Since:
- 0.1.0
-
-
Constructor Summary
Constructors Constructor Description JsonCustomResponseFormat(String json)
Default constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description List<Map<String,Object>>
getEntries()
Retrieves all the entries.<T> List<T>
toListOf(Class<T> clazz)
Converts the JSON string into a list of the specified class.String
toString()
-
-
-
Constructor Detail
-
JsonCustomResponseFormat
public JsonCustomResponseFormat(String json)
Default constructor.
- Parameters:
json
- the JSON to format
-
-
Method Detail
-
getEntries
public List<Map<String,Object>> getEntries()
Retrieves all the entries.
- Returns:
- all the entries
-
toListOf
public <T> List<T> toListOf(Class<T> clazz)
Converts the JSON string into a list of the specified class.
- Type Parameters:
T
- the data type of the list- Parameters:
clazz
- the class to convert each JSON entry to- Returns:
- a list of elements, which type is the specified class. Each element represents the corresponding entry in the JSON
-
-