com.aliyun.odps.utils.GsonObjectBuilder Maven / Gradle / Ivy
The newest version!
package com.aliyun.odps.utils;
import java.io.IOException;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.aliyun.odps.Instance;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParseException;
import com.google.gson.TypeAdapter;
import com.google.gson.internal.LinkedTreeMap;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonToken;
import com.google.gson.stream.JsonWriter;
/**
* @author [email protected]
*
* A gson builder SINGLETON that can return a gson object with proper settings.
* The gson object provided by this builder can deal with Object type
* in a Map well, especially when encoutering Double/Long in fact but
* declared as Object.
*/
public class GsonObjectBuilder {
/**
* An adapter which fixes Gson's drawback. It can deal with
* Double/Long well.
*/
public static class GsonObjectAdapter extends TypeAdapter
© 2015 - 2025 Weber Informatics LLC | Privacy Policy