Package org.ldaptive.io
Class JsonReader
- java.lang.Object
-
- org.ldaptive.io.JsonReader
-
- All Implemented Interfaces:
SearchResultReader
public class JsonReader extends Object implements SearchResultReader
Reads JSON from aReaderand returns aSearchResult.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classJsonReader.SearchResultDeserializerDeserializes aSearchResultby iterating over the json elements.
-
Field Summary
Fields Modifier and Type Field Description private com.google.gson.GsongsonTo convert JSON to a search result.private ReaderjsonReaderReader to read from.
-
Constructor Summary
Constructors Constructor Description JsonReader(Reader reader)Creates a new json reader.JsonReader(Reader reader, SortBehavior sb)Creates a new json reader.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SearchResultread()Reads JSON data from the reader and returns a search result.
-
-
-
Field Detail
-
jsonReader
private final Reader jsonReader
Reader to read from.
-
gson
private final com.google.gson.Gson gson
To convert JSON to a search result.
-
-
Constructor Detail
-
JsonReader
public JsonReader(Reader reader)
Creates a new json reader.- Parameters:
reader- to read JSON from
-
JsonReader
public JsonReader(Reader reader, SortBehavior sb)
Creates a new json reader.- Parameters:
reader- to read JSON fromsb- sort behavior of the search result
-
-
Method Detail
-
read
public SearchResult read() throws IOException
Reads JSON data from the reader and returns a search result.- Specified by:
readin interfaceSearchResultReader- Returns:
- search result derived from the JSON
- Throws:
IOException- if an error occurs using the reader
-
-