@Test void shouldNullPointerOnNullMap() { assertThrows(NullPointerException.class, () -> JsonObject.from(null)); }
public static JsonObject from(final Map<String, ?> mapData) { if (mapData == null) { throw new NullPointerException("Null input Map unsupported"); } JsonObject result = new JsonObject(mapData.size()); try { mapData.forEach((key, value) -> { requireNonNull(key, "The key is not allowed to be null"); result.put(key, coerce(value)); }); } catch (ClassCastException e) { throw InvalidArgumentException.fromMessage("Map key must be String", e); } return result; }
JsonObject extends JsonValue implements Serializable { public static JsonObject from(final Map<String, ?> mapData) { if (mapData == null) { throw new NullPointerException("Null input Map unsupported"); } JsonObject result = new JsonObject(mapData.size()); try { mapData.forEach((key, value) -> { requireNonNull(key, "The key is not allowed to be null"); result.put(key, coerce(value)); }); } catch (ClassCastException e) { throw InvalidArgumentException.fromMessage("Map key must be String", e); } return result; } }
JsonObject extends JsonValue implements Serializable { public static JsonObject from(final Map<String, ?> mapData) { if (mapData == null) { throw new NullPointerException("Null input Map unsupported"); } JsonObject result = new JsonObject(mapData.size()); try { mapData.forEach((key, value) -> { requireNonNull(key, "The key is not allowed to be null"); result.put(key, coerce(value)); }); } catch (ClassCastException e) { throw InvalidArgumentException.fromMessage("Map key must be String", e); } return result; } private  JsonObject(); private  JsonObject(int initialCapacity); }
JsonObject extends JsonValue implements Serializable { public static JsonObject from(final Map<String, ?> mapData) { if (mapData == null) { throw new NullPointerException("Null input Map unsupported"); } JsonObject result = new JsonObject(mapData.size()); try { mapData.forEach((key, value) -> { requireNonNull(key, "The key is not allowed to be null"); result.put(key, coerce(value)); }); } catch (ClassCastException e) { throw InvalidArgumentException.fromMessage("Map key must be String", e); } return result; } private  JsonObject(); private  JsonObject(int initialCapacity); static JsonObject create(); static JsonObject create(int initialCapacity); static JsonObject from(final Map<String, ?> mapData); static JsonObject fromJson(final String s); static JsonObject fromJson(final byte[] s); @Stability.Volatile JsonObjectCrypto crypto(CryptoManager cryptoManager); @Stability.Volatile JsonObjectCrypto crypto(Collection collection); @Stability.Volatile JsonObjectCrypto crypto(ClusterEnvironment env); JsonObject put(final String name, final Object value); Object get(final String name); JsonObject put(final String name, final String value); String getString(String name); JsonObject put(String name, int value); Integer getInt(String name); JsonObject put(String name, long value); Long getLong(String name); JsonObject put(String name, double value); Double getDouble(String name); JsonObject put(String name, boolean value); Boolean getBoolean(String name); JsonObject put(String name, JsonObject value); JsonObject put(String name, Map<String, ?> value); JsonObject getObject(String name); JsonObject put(String name, JsonArray value); JsonObject put(String name, Number value); JsonObject put(String name, List<?> value); JsonArray getArray(String name); BigInteger getBigInteger(String name); BigDecimal getBigDecimal(String name); Number getNumber(String name); JsonObject putNull(String name); JsonObject removeKey(String name); Set<String> getNames(); boolean isEmpty(); Map<String, Object> toMap(); boolean containsKey(String name); boolean containsValue(Object value); int size(); @Override String toString(); byte[] toBytes(); @Override boolean equals(Object o); @Override int hashCode(); }
JsonObject extends JsonValue implements Serializable { public static JsonObject from(final Map<String, ?> mapData) { if (mapData == null) { throw new NullPointerException("Null input Map unsupported"); } JsonObject result = new JsonObject(mapData.size()); try { mapData.forEach((key, value) -> { requireNonNull(key, "The key is not allowed to be null"); result.put(key, coerce(value)); }); } catch (ClassCastException e) { throw InvalidArgumentException.fromMessage("Map key must be String", e); } return result; } private  JsonObject(); private  JsonObject(int initialCapacity); static JsonObject create(); static JsonObject create(int initialCapacity); static JsonObject from(final Map<String, ?> mapData); static JsonObject fromJson(final String s); static JsonObject fromJson(final byte[] s); @Stability.Volatile JsonObjectCrypto crypto(CryptoManager cryptoManager); @Stability.Volatile JsonObjectCrypto crypto(Collection collection); @Stability.Volatile JsonObjectCrypto crypto(ClusterEnvironment env); JsonObject put(final String name, final Object value); Object get(final String name); JsonObject put(final String name, final String value); String getString(String name); JsonObject put(String name, int value); Integer getInt(String name); JsonObject put(String name, long value); Long getLong(String name); JsonObject put(String name, double value); Double getDouble(String name); JsonObject put(String name, boolean value); Boolean getBoolean(String name); JsonObject put(String name, JsonObject value); JsonObject put(String name, Map<String, ?> value); JsonObject getObject(String name); JsonObject put(String name, JsonArray value); JsonObject put(String name, Number value); JsonObject put(String name, List<?> value); JsonArray getArray(String name); BigInteger getBigInteger(String name); BigDecimal getBigDecimal(String name); Number getNumber(String name); JsonObject putNull(String name); JsonObject removeKey(String name); Set<String> getNames(); boolean isEmpty(); Map<String, Object> toMap(); boolean containsKey(String name); boolean containsValue(Object value); int size(); @Override String toString(); byte[] toBytes(); @Override boolean equals(Object o); @Override int hashCode();  }