Package com.suse.salt.netapi.parser
Class JsonParser<T>
- java.lang.Object
 - 
- com.suse.salt.netapi.parser.JsonParser<T>
 
 
- 
- Type Parameters:
 T- The result type this parser produces.
public class JsonParser<T> extends Object
Parser for Salt API responses. 
- 
- 
Field Summary
Fields Modifier and Type Field Description static JsonParser<Event>EVENTSstatic com.google.gson.GsonGSONstatic JsonParser<Map<String,Object>>MAPstatic JsonParser<Return<List<Map<String,Object>>>>RUN_RESULTSstatic JsonParser<Return<List<Map<String,Result<SSHRawResult>>>>>RUNSSHRAW_RESULTSstatic JsonParser<Stats>STATSstatic JsonParser<Return<String>>STRINGstatic JsonParser<Return<List<Token>>>TOKEN 
- 
Constructor Summary
Constructors Constructor 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. 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tparse(InputStream inputStream)Parses a Json response that has a direct representation as a Java class.Tparse(String jsonString)Parse JSON given as string. 
 - 
 
- 
- 
Field Detail
- 
GSON
public static final com.google.gson.Gson GSON
 
- 
STRING
public static final JsonParser<Return<String>> STRING
 
- 
TOKEN
public static final JsonParser<Return<List<Token>>> TOKEN
 
- 
RUNSSHRAW_RESULTS
public static final JsonParser<Return<List<Map<String,Result<SSHRawResult>>>>> RUNSSHRAW_RESULTS
 
- 
STATS
public static final JsonParser<Stats> STATS
 
- 
MAP
public static final JsonParser<Map<String,Object>> MAP
 
- 
EVENTS
public static final JsonParser<Event> EVENTS
 
 - 
 
- 
Constructor Detail
- 
JsonParser
public JsonParser(com.google.gson.reflect.TypeToken<T> type)
Created a new JsonParser for the given type.- Parameters:
 type- A TypeToken describing the type this parser produces.
 
- 
JsonParser
public JsonParser(com.google.gson.reflect.TypeToken<T> type, com.google.gson.Gson gson)
Created a new JsonParser for the given type.- Parameters:
 type- A TypeToken describing the type this parser produces.gson- Gson instance to use for parsing.
 
 - 
 
- 
Method Detail
- 
parse
public T parse(InputStream inputStream)
Parses a Json response that has a direct representation as a Java class.- Parameters:
 inputStream- result stream to parse.- Returns:
 - The parsed value.
 
 
 - 
 
 -