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

    Fields
    Modifier and Type
    Field
    Description
    private final com.google.gson.TypeAdapter<com.google.gson.JsonElement>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    DocumentTypeAdapter(@NonNull com.google.gson.Gson gsonInstance)
    Constructs a new instance of the document type adapter.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NonNull eu.cloudnetservice.driver.document.Document
    read(@NonNull com.google.gson.stream.JsonReader in)
    void
    write(@NonNull com.google.gson.stream.JsonWriter out, @Nullable eu.cloudnetservice.driver.document.Document value)

    Methods inherited from class com.google.gson.TypeAdapter

    fromJson, fromJson, fromJsonTree, nullSafe, toJson, toJson, toJsonTree

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • jsonElementTypeAdapter

      private final com.google.gson.TypeAdapter<com.google.gson.JsonElement> jsonElementTypeAdapter
  • Constructor Details

    • DocumentTypeAdapter

      public DocumentTypeAdapter(@NonNull @NonNull com.google.gson.Gson gsonInstance)
      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:
      write in class com.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:
      read in class com.google.gson.TypeAdapter<eu.cloudnetservice.driver.document.Document>
      Throws:
      IOException