缓存

@param key 键
@param jsonObject 值
550573
private void put(String key, JSONObject jsonObject) {
        if (jsonStore.size() > maxCache || jsonStore.size() == Integer.MAX_VALUE) {
            // 清除缓存
            jsonStore.clear();
        }
        jsonStore.put(key, jsonObject);
    }
1164088
public static void jsonPutIn(JSONObject jsonObject, Object object) throws IllegalAccessException {
        Field[] fields = object.getClass().getDeclaredFields();
        for (Field field : fields) {
            field.setAccessible(true);
            field.set(object, TypeUtils.castToJavaBean(jsonObject.get(field.getName()), field.getType()));
        }
    }
859201
public JSONArray getJSONArray(K key) {
		final Object object = this.getObj(key);
		if(null == object) {
			return null;
		}
		
		if(object instanceof JSONArray) {
			return (JSONArray) object;
		}
		return new JSONArray(object);
	}
227042
public void put(String key, Object object, boolean serialize){
        if(serialize)
            put(key,gson.toJson(object));
        else
            put(key,object);
    }
342413
public JSONObject put(String key, double value) throws JSONException {
        put(key, Double.valueOf(value));
        return this;
    }
1285487
public static void config(JSONObject jsonObject) {
        config(jsonObject.getString("host"), jsonObject.getString("personal"), jsonObject.getString("from"),
                jsonObject.getString("key"), jsonObject.getInteger("port"));
        setSslEnable(jsonObject.getBoolean("ssl"));
    }
956255
public String getString(String key) throws JSONException {
        Object object = this.get(key);
        if (object instanceof String) {
            return (String) object;
        } else if( NULL.equals(object) ) {
            return (String) null;
        }
        throw new JSONException("JSONObject[" + quote(key) + "] not a string.");
    }
1252706
public JsonReaderI<?> startObject(String key) throws ParseException, IOException {
		throw new RuntimeException(ERR_MSG + " startObject(String key) in " + this.getClass() + " key=" + key);
	}
930991
public JSONObject optJSONObject(String key) {
        Object object = this.opt(key);
        return object instanceof JSONObject ? (JSONObject) object : null;
    }
542983
void update(JsonObject jsonObject) {
        for (JsonObject.Member member : jsonObject) {
            if (member.getValue().isNull()) {
                continue;
            }

            this.parseJSONMember(member);
        }

        this.clearPendingChanges();
    }
1327005
@Nullable
    static Map<String, Object> jsonObjectToMap(@Nullable JSONObject jsonObject) {
        if (jsonObject == null) {
            return null;
        }
        Map<String, Object> map = new HashMap<>();
        Iterator<String> keyIterator = jsonObject.keys();
        while (keyIterator.hasNext()) {
            String key = keyIterator.next();
            Object value = jsonObject.opt(key);
            if (NULL.equals(value) || value == null) {
                continue;
            }

            if (value instanceof JSONObject) {
                map.put(key, jsonObjectToMap((JSONObject) value));
            } else if (value instanceof JSONArray) {
                map.put(key, jsonArrayToList((JSONArray) value));
            } else {
                map.put(key, value);
            }
        }
        return map;
    }
222574
public void setData(JSONObject data) {
    try {
      Map<String, Object> map = new HashMap<String, Object>();
      Iterator iter = data.keySet().iterator();
      while (iter.hasNext()) {
        String key = (String) iter.next();
        Object value = data.get(key);
        map.put(key, value);
      }
      this.pushData.put("data", map);
    } catch (Exception exception) {
      LOGGER.w(exception);
    }
  }
128411
private static JsonObject getJsonObject(JsonObject object, String propName) {
        JsonObject obj = null;
        JsonValue val = object.get(propName);
        if (val != null && val.getValueType() == ValueType.OBJECT) {
            obj = val.asJsonObject();
        }
        return obj;
    }
1102035
public void update( JSONObject json )
    {
        accessToken = json.getString( ACCESS_TOKEN );
        tokenType = json.getString( TOKEN_TYPE );
        expiresAt = calculateExpiresAt( json );
        if ( json.has( OAuth2.REFRESH_TOKEN ) ) {
            refreshToken = json.getString( OAuth2.REFRESH_TOKEN );
        }
    }
898621
public @Nonnull JsonBuilder put(String key, String s) {
        object.put(key, primitive(s));
        return this;
    }
1155859
String acceptObjectKey(JsonEvent event) throws IOException {
        ensureEvent(event, JsonEvent.STRING);
        return parseObjectKey();
    }
712546
public static Map<String, Object> jsonObjectToMap(JSONObject jsonObj)
    {
        Map<String, Object> map = new Hashtable<String, Object>();
        
        Iterator<?> iterator = jsonObj.keys();
        while (iterator.hasNext())
        {
            try {
                String key = (String)iterator.next();
                String value = jsonObj.getString(key);  // TODO what if this is a JSONObject?
                map.put(key, value);
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }
        return map;
    }