@Test public void testCompareTo() { JcrNs foo = JcrNs.create(prefix, uri); JcrNs bar = JcrNs.create("bar", "http: assertEquals("compare ns based on prefix", "foo".compareTo("bar"), foo.compareTo(bar)); JcrNs fooDiff = JcrNs.create(prefix, "http: assertNotEquals("compare diff based on prefix and diff uri", 0, foo.compareTo(fooDiff)); }
@Override public int compareTo(final @NotNull JcrNs o) { return Optional.of(getPrefix().compareTo(o.getPrefix())) .filter(comp -> comp != 0).orElseGet(() -> getUri().compareTo(o.getUri())); }
JcrNs implements JsonObjectConvertible, Comparable<JcrNs> { @Override public int compareTo(final @NotNull JcrNs o) { return Optional.of(getPrefix().compareTo(o.getPrefix())) .filter(comp -> comp != 0).orElseGet(() -> getUri().compareTo(o.getUri())); } }
JcrNs implements JsonObjectConvertible, Comparable<JcrNs> { @Override public int compareTo(final @NotNull JcrNs o) { return Optional.of(getPrefix().compareTo(o.getPrefix())) .filter(comp -> comp != 0).orElseGet(() -> getUri().compareTo(o.getUri())); }  }
JcrNs implements JsonObjectConvertible, Comparable<JcrNs> { @Override public int compareTo(final @NotNull JcrNs o) { return Optional.of(getPrefix().compareTo(o.getPrefix())) .filter(comp -> comp != 0).orElseGet(() -> getUri().compareTo(o.getUri())); }  @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> { @Override public int compareTo(final @NotNull JcrNs o) { return Optional.of(getPrefix().compareTo(o.getPrefix())) .filter(comp -> comp != 0).orElseGet(() -> getUri().compareTo(o.getUri())); }  @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);  }