redis.clients.jedis.json.DefaultGsonObjectMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jedis_preview Show documentation
Show all versions of jedis_preview Show documentation
Jedis is a blazingly small and sane Redis java client.
The newest version!
package redis.clients.jedis.json;
import com.google.gson.Gson;
/**
* Use the default {@link Gson} configuration for serialization and deserialization JSON
* operations.
* When none is explicitly set, this will be set.
* @see JsonObjectMapper Create a custom JSON serializer/deserializer
*/
public class DefaultGsonObjectMapper implements JsonObjectMapper {
/**
* Instance of Gson object with default gson configuration.
*/
private final Gson gson = new Gson();
@Override
public T fromJson(String value, Class valueType) {
return gson.fromJson(value, valueType);
}
@Override
public String toJson(Object value) {
return gson.toJson(value);
}
}