@Test void shouldFailToConvertNonObjectJson() { String bad1 = "true"; String bad2 = "123"; String bad3 = "\"string\""; String bad4 = "[ 123 ]"; assertThrows(InvalidArgumentException.class, () -> JsonObject.fromJson(bad1)); assertThrows(InvalidArgumentException.class, () -> JsonObject.fromJson(bad2)); assertThrows(InvalidArgumentException.class, () -> JsonObject.fromJson(bad3)); assertThrows(InvalidArgumentException.class, () -> JsonObject.fromJson(bad4)); }
public static JsonObject fromJson(final String s) { try { return JacksonTransformers.stringToJsonObject(s); } catch (Exception e) { throw InvalidArgumentException.fromMessage("Cannot convert string to JsonObject", e); } }
JsonObject extends JsonValue implements Serializable { public static JsonObject fromJson(final String s) { try { return JacksonTransformers.stringToJsonObject(s); } catch (Exception e) { throw InvalidArgumentException.fromMessage("Cannot convert string to JsonObject", e); } } }
JsonObject extends JsonValue implements Serializable { public static JsonObject fromJson(final String s) { try { return JacksonTransformers.stringToJsonObject(s); } catch (Exception e) { throw InvalidArgumentException.fromMessage("Cannot convert string to JsonObject", e); } } private  JsonObject(); private  JsonObject(int initialCapacity); }
JsonObject extends JsonValue implements Serializable { public static JsonObject fromJson(final String s) { try { return JacksonTransformers.stringToJsonObject(s); } catch (Exception e) { throw InvalidArgumentException.fromMessage("Cannot convert string to JsonObject", e); } } 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 fromJson(final String s) { try { return JacksonTransformers.stringToJsonObject(s); } catch (Exception e) { throw InvalidArgumentException.fromMessage("Cannot convert string to JsonObject", e); } } 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();  }