Class DefaultGsonObjectMapper

java.lang.Object
redis.clients.jedis.json.DefaultGsonObjectMapper
All Implemented Interfaces:
JsonObjectMapper

public class DefaultGsonObjectMapper extends Object implements JsonObjectMapper
Use the default Gson configuration for serialization and deserialization JSON operations.

When none is explicitly set, this will be set.

See Also:
  • Field Details

    • gson

      private final com.google.gson.Gson gson
      Instance of Gson object with default gson configuration.
  • Constructor Details

    • DefaultGsonObjectMapper

      public DefaultGsonObjectMapper()
  • Method Details

    • fromJson

      public <T> T fromJson(String value, Class<T> valueType)
      Description copied from interface: JsonObjectMapper
      Perform deserialization from JSON format string to the given type object as argument.
      Specified by:
      fromJson in interface JsonObjectMapper
      Type Parameters:
      T - the type object to convert
      Parameters:
      value - the JSON format
      valueType - the object type to convert
      Returns:
      the instance of an object to the type given argument
    • toJson

      public String toJson(Object value)
      Description copied from interface: JsonObjectMapper
      Perform serialization from object to JSON format string.
      Specified by:
      toJson in interface JsonObjectMapper
      Parameters:
      value - the object to convert
      Returns:
      the JSON format string