All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cl.transbank.onepay.util.OnepayJsonUtil Maven / Gradle / Ivy

There is a newer version: 5.0.0
Show newest version
package cl.transbank.onepay.util;

import com.google.gson.Gson;

public final class OnepayJsonUtil implements JsonUtil {
    private static volatile OnepayJsonUtil instance;
    private Gson gson;

    private OnepayJsonUtil() {
        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 OnepayJsonUtil getInstance() {
        if (null == instance) {
            synchronized (OnepayJsonUtil.class) {
                instance = new OnepayJsonUtil();
            }
        }

        return instance;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy