@Test public void testFromJson() { assertNull("should be null if either prefix and uri are missing", JcrNs.fromJson(JsonValue.EMPTY_JSON_OBJECT)); assertNull("should be null prefix is missing", JcrNs.fromJson(key(KEYS.prefix(), prefix).get())); assertNull("should be null if uri is missing", JcrNs.fromJson(key(KEYS.uri(), uri).get())); JcrNs complete = JcrNs.fromJson(key(KEYS.prefix(), prefix).key(KEYS.uri(), uri).get()); assertNotNull("complete should not be null", complete); assertEquals("complete prefix should be", prefix, complete.getPrefix()); assertEquals("complete prefix should be", uri, complete.getUri()); }
public static @Nullable JcrNs fromJson(final @NotNull JsonObject json) { if (!json.containsKey(KEYS.prefix()) || !json.containsKey(KEYS.uri())) { return null; } JcrNs jcrNs = new JcrNs(); jcrNs.setPrefix(json.getString(KEYS.prefix(), "")); jcrNs.setUri(json.getString(KEYS.uri(), "")); return jcrNs; }
JcrNs implements JsonObjectConvertible, Comparable<JcrNs> { public static @Nullable JcrNs fromJson(final @NotNull JsonObject json) { if (!json.containsKey(KEYS.prefix()) || !json.containsKey(KEYS.uri())) { return null; } JcrNs jcrNs = new JcrNs(); jcrNs.setPrefix(json.getString(KEYS.prefix(), "")); jcrNs.setUri(json.getString(KEYS.uri(), "")); return jcrNs; } }
JcrNs implements JsonObjectConvertible, Comparable<JcrNs> { public static @Nullable JcrNs fromJson(final @NotNull JsonObject json) { if (!json.containsKey(KEYS.prefix()) || !json.containsKey(KEYS.uri())) { return null; } JcrNs jcrNs = new JcrNs(); jcrNs.setPrefix(json.getString(KEYS.prefix(), "")); jcrNs.setUri(json.getString(KEYS.uri(), "")); return jcrNs; }  }
JcrNs implements JsonObjectConvertible, Comparable<JcrNs> { public static @Nullable JcrNs fromJson(final @NotNull JsonObject json) { if (!json.containsKey(KEYS.prefix()) || !json.containsKey(KEYS.uri())) { return null; } JcrNs jcrNs = new JcrNs(); jcrNs.setPrefix(json.getString(KEYS.prefix(), "")); jcrNs.setUri(json.getString(KEYS.uri(), "")); return jcrNs; }  @NotNull static JcrNs.JsonKeys keys(); String getPrefix(); void setPrefix(String prefix); String getUri(); void setUri(String uri); static @Nullable JcrNs fromJson(final @NotNull JsonObject json); static @NotNull JcrNs create(final @NotNull String prefix, final @NotNull String uri); @Override boolean equals(final Object o); @Override int hashCode(); @Override JsonObject toJson(); @Override String toString(); @Override int compareTo(final @NotNull JcrNs o); }
JcrNs implements JsonObjectConvertible, Comparable<JcrNs> { public static @Nullable JcrNs fromJson(final @NotNull JsonObject json) { if (!json.containsKey(KEYS.prefix()) || !json.containsKey(KEYS.uri())) { return null; } JcrNs jcrNs = new JcrNs(); jcrNs.setPrefix(json.getString(KEYS.prefix(), "")); jcrNs.setUri(json.getString(KEYS.uri(), "")); return jcrNs; }  @NotNull static JcrNs.JsonKeys keys(); String getPrefix(); void setPrefix(String prefix); String getUri(); void setUri(String uri); static @Nullable JcrNs fromJson(final @NotNull JsonObject json); static @NotNull JcrNs create(final @NotNull String prefix, final @NotNull String uri); @Override boolean equals(final Object o); @Override int hashCode(); @Override JsonObject toJson(); @Override String toString(); @Override int compareTo(final @NotNull JcrNs o);  }