Class VarSecretAdaptor

java.lang.Object
com.walkfares.odsl.var.adaptor.VarSecretAdaptor
All Implemented Interfaces:
com.google.gson.JsonDeserializer<VarSecret>, com.google.gson.JsonSerializer<VarSecret>

public class VarSecretAdaptor
extends Object
implements com.google.gson.JsonSerializer<VarSecret>, com.google.gson.JsonDeserializer<VarSecret>
  • Constructor Summary

    Constructors 
    Constructor Description
    VarSecretAdaptor()  
  • Method Summary

    Modifier and Type Method Description
    VarSecret deserialize​(com.google.gson.JsonElement json, Type typeOfT, com.google.gson.JsonDeserializationContext context)  
    com.google.gson.JsonElement serialize​(VarSecret src, Type typeOfSrc, com.google.gson.JsonSerializationContext context)
    Gson invokes this call-back method during serialization when it encounters a field of the specified type.

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • serialize

      public com.google.gson.JsonElement serialize​(VarSecret src, Type typeOfSrc, com.google.gson.JsonSerializationContext context)
      Gson invokes this call-back method during serialization when it encounters a field of the specified type.

      In the implementation of this call-back method, you should consider invoking JsonSerializationContext.serialize(Object, Type) method to create JsonElements for any non-trivial field of the src object. However, you should never invoke it on the src object itself since that will cause an infinite loop (Gson will call your call-back method again).

      Specified by:
      serialize in interface com.google.gson.JsonSerializer<VarSecret>
      Parameters:
      src - the object that needs to be converted to Json.
      typeOfSrc - the actual type (fully genericized version) of the source object.
      context -
      Returns:
      a JsonElement corresponding to the specified object.
    • deserialize

      public VarSecret deserialize​(com.google.gson.JsonElement json, Type typeOfT, com.google.gson.JsonDeserializationContext context) throws com.google.gson.JsonParseException
      Specified by:
      deserialize in interface com.google.gson.JsonDeserializer<VarSecret>
      Throws:
      com.google.gson.JsonParseException