
cn.leancloud.gson.GsonObject Maven / Gradle / Ivy
package cn.leancloud.gson;
import cn.leancloud.json.JSONArray;
import cn.leancloud.json.JSONObject;
import cn.leancloud.json.TypeReference;
import com.google.gson.JsonElement;
import java.lang.reflect.Type;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.sql.Timestamp;
import java.util.*;
public class GsonObject extends JSONObject{
private com.google.gson.JsonObject gsonObject;
public GsonObject(com.google.gson.JsonObject object) {
this.gsonObject = object;
}
public GsonObject(Map map) {
this.gsonObject = new com.google.gson.JsonObject();
if (null != map) {
for (Map.Entry entry : map.entrySet()) {
gsonObject.add(entry.getKey(), GsonWrapper.toJsonElement(entry.getValue()));
}
}
}
static class InnerEntry implements Map.Entry {
private String key;
private Object value;
InnerEntry(String key, JsonElement value) {
this.key = key;
this.value = GsonWrapper.toJavaObject(value);
}
@Override
public String getKey() {
return this.key;
}
@Override
public Object getValue() {
return this.value;
}
@Override
public Object setValue(Object value) {
this.value = value;
return value;
}
}
public GsonObject() {
this.gsonObject = new com.google.gson.JsonObject();
}
public com.google.gson.JsonObject getRawObject() {
return this.gsonObject;
}
public int size() {
return this.gsonObject.size();
}
public boolean isEmpty() {
return this.gsonObject.size() <= 0;
}
public boolean containsKey(Object key) {
return this.gsonObject.has((String)key);
}
public boolean containsValue(Object v) {
Collection
© 2015 - 2025 Weber Informatics LLC | Privacy Policy