cl.transbank.util.JsonUtilImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of transbank-sdk-java Show documentation
Show all versions of transbank-sdk-java Show documentation
Tranbank API integration SDK for Java Projects
package cl.transbank.util;
import com.google.gson.Gson;
public final class JsonUtilImpl implements JsonUtil {
private static volatile JsonUtilImpl instance;
private Gson gson;
private JsonUtilImpl() {
super();
gson = new Gson();
}
public String jsonEncode(Object o) {
return gson.toJson(o);
}
public T jsonDecode(String json, Class clazz) {
return gson.fromJson(json, clazz);
}
public static JsonUtilImpl getInstance() {
if (null == instance) {
synchronized (JsonUtilImpl.class) {
instance = new JsonUtilImpl();
}
}
return instance;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy