T
- The result type this parser produces.public class JsonParser<T>
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static JsonParser<Event> |
EVENTS |
private com.google.gson.Gson |
gson |
static com.google.gson.Gson |
GSON |
static JsonParser<java.util.Map<java.lang.String,java.lang.Object>> |
MAP |
static JsonParser<Return<java.util.List<java.util.Map<java.lang.String,java.lang.Object>>>> |
RUN_RESULTS |
static JsonParser<Return<java.util.List<java.util.Map<java.lang.String,Result<SSHRawResult>>>>> |
RUNSSHRAW_RESULTS |
static JsonParser<Stats> |
STATS |
static JsonParser<Return<java.lang.String>> |
STRING |
static JsonParser<Return<java.util.List<Token>>> |
TOKEN |
private com.google.gson.reflect.TypeToken<T> |
type |
Constructor and Description |
---|
JsonParser(com.google.gson.reflect.TypeToken<T> type)
Created a new JsonParser for the given type.
|
JsonParser(com.google.gson.reflect.TypeToken<T> type,
com.google.gson.Gson gson)
Created a new JsonParser for the given type.
|
Modifier and Type | Method and Description |
---|---|
T |
parse(java.io.InputStream inputStream)
Parses a Json response that has a direct representation as a Java class.
|
T |
parse(java.lang.String jsonString)
Parse JSON given as string.
|
public static final com.google.gson.Gson GSON
public static final JsonParser<Return<java.lang.String>> STRING
public static final JsonParser<Return<java.util.List<Token>>> TOKEN
public static final JsonParser<Return<java.util.List<java.util.Map<java.lang.String,java.lang.Object>>>> RUN_RESULTS
public static final JsonParser<Return<java.util.List<java.util.Map<java.lang.String,Result<SSHRawResult>>>>> RUNSSHRAW_RESULTS
public static final JsonParser<Stats> STATS
public static final JsonParser<java.util.Map<java.lang.String,java.lang.Object>> MAP
public static final JsonParser<Event> EVENTS
private final com.google.gson.reflect.TypeToken<T> type
private final com.google.gson.Gson gson
public JsonParser(com.google.gson.reflect.TypeToken<T> type)
type
- A TypeToken describing the type this parser produces.public JsonParser(com.google.gson.reflect.TypeToken<T> type, com.google.gson.Gson gson)
type
- A TypeToken describing the type this parser produces.gson
- Gson instance to use for parsing.public T parse(java.io.InputStream inputStream)
inputStream
- result stream to parse.public T parse(java.lang.String jsonString)
jsonString
- JSON input given as string