JsonValue implements Parcelable, JsonSerializable { private static JsonValue wrapMap(@NonNull Map<?, ?> map) throws JsonException { Map<String, JsonValue> jsonValueMap = new HashMap<>(); for (Map.Entry entry : map.entrySet()) { if (!(entry.getKey() instanceof String)) { throw new JsonException("Only string map keys are accepted."); } if (entry.getValue() != null) { jsonValueMap.put((String) entry.getKey(), wrap(entry.getValue())); } } return new JsonValue(new JsonMap(jsonValueMap)); } private  JsonValue(@Nullable Object value); @Nullable Object getValue(); @Nullable String getString(); @NonNull String getString(@NonNull String defaultValue); @NonNull String optString(); int getInt(int defaultValue); float getFloat(float defaultValue); double getDouble(double defaultValue); long getLong(long defaultValue); @Nullable Number getNumber(); boolean getBoolean(boolean defaultValue); @Nullable JsonList getList(); @NonNull JsonList optList(); @Nullable JsonMap getMap(); @NonNull JsonMap optMap(); boolean isNull(); boolean isString(); boolean isInteger(); boolean isDouble(); boolean isFloat(); boolean isLong(); boolean isNumber(); boolean isBoolean(); boolean isJsonMap(); boolean isJsonList(); @NonNull static JsonValue parseString(@Nullable String jsonString); @Override boolean equals(@Nullable Object object); @Override int hashCode(); @NonNull @Override String toString(); @NonNull static JsonValue wrap(@Nullable String value); @NonNull static JsonValue wrap(char value); @NonNull static JsonValue wrap(int value); @NonNull static JsonValue wrap(long value); @NonNull static JsonValue wrap(boolean value); @NonNull static JsonValue wrap(double value); @NonNull static JsonValue wrap(@Nullable JsonSerializable value); @NonNull static JsonValue wrapOpt(@Nullable Object object); @NonNull static JsonValue wrap(@Nullable Object object, @NonNull JsonValue defaultValue); @NonNull static JsonValue wrap(@Nullable Object object); @Override int describeContents(); @Override void writeToParcel(@NonNull Parcel dest, int flags); @NonNull @Override JsonValue toJsonValue(); @NonNull
    final static JsonValue NULL; @NonNull
    static final Parcelable.Creator<JsonValue> CREATOR; }
@Test public void testWrapMap() throws JSONException, JsonException { Map<String, Object> map = new HashMap<>(primitiveMap); map.put("map", primitiveMap); map.put("collection", primitiveList); JsonValue jsonValue = JsonValue.wrap(map); assertTrue(jsonValue.getValue() instanceof JsonMap); JsonMap jsonMap = jsonValue.getMap(); assertNotNull(jsonMap); for (Map.Entry<String, Object> entry : map.entrySet()) { JsonValue value = JsonValue.wrap(entry.getValue()); assertEquals(value, jsonMap.get(entry.getKey())); } assertEquals(map.size(), jsonMap.size()); }