Class DocumentTypeAdapter
java.lang.Object
com.google.gson.TypeAdapter<eu.cloudnetservice.driver.document.Document>
eu.cloudnetservice.driver.impl.document.gson.DocumentTypeAdapter
final class DocumentTypeAdapter
extends com.google.gson.TypeAdapter<eu.cloudnetservice.driver.document.Document>
A type adapter that can serialize documents of any type into a json object and read documents into a json type.
- Since:
- 4.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final com.google.gson.TypeAdapter<com.google.gson.JsonElement> -
Constructor Summary
ConstructorsConstructorDescriptionDocumentTypeAdapter(@NonNull com.google.gson.Gson gsonInstance) Constructs a new instance of the document type adapter. -
Method Summary
Methods inherited from class com.google.gson.TypeAdapter
fromJson, fromJson, fromJsonTree, nullSafe, toJson, toJson, toJsonTree
-
Field Details
-
jsonElementTypeAdapter
private final com.google.gson.TypeAdapter<com.google.gson.JsonElement> jsonElementTypeAdapter
-
-
Constructor Details
-
DocumentTypeAdapter
Constructs a new instance of the document type adapter.- Parameters:
gsonInstance- the gson instance this type adapter instance got bound to.- Throws:
NullPointerException- if the given gson instance is null.
-
-
Method Details
-
write
public void write(@NonNull @NonNull com.google.gson.stream.JsonWriter out, @Nullable @Nullable eu.cloudnetservice.driver.document.Document value) throws IOException - Specified by:
writein classcom.google.gson.TypeAdapter<eu.cloudnetservice.driver.document.Document>- Throws:
IOException
-
read
@NonNull public @NonNull eu.cloudnetservice.driver.document.Document read(@NonNull @NonNull com.google.gson.stream.JsonReader in) throws IOException - Specified by:
readin classcom.google.gson.TypeAdapter<eu.cloudnetservice.driver.document.Document>- Throws:
IOException
-