@Test public void testToJson() { final ForcedRoot.JsonKeys keys = ForcedRoot.keys(); final String path = "/correct/path"; final String primaryType = "primaryType"; final List<String> mixinTypes = Collections.singletonList("mixinType"); final ForcedRoot emptyRoot = new ForcedRoot(); assertEquals("empty root toJson should be empty", JsonValue.EMPTY_JSON_OBJECT, emptyRoot.toJson()); final ForcedRoot pathRoot = new ForcedRoot().withPath(path); assertEquals("path root toJson should have path", key(keys.path(), path).get(), pathRoot.toJson()); final ForcedRoot primaryTypeRoot = new ForcedRoot().withPrimaryType(primaryType); assertEquals("primaryType root toJson should have primaryType", key(keys.primaryType(), primaryType).get(), primaryTypeRoot.toJson()); final ForcedRoot mixinTypeRoot = new ForcedRoot().withMixinTypes(mixinTypes.get(0)); assertEquals("mixinTypes root toJson should have mixinTypes", key(keys.mixinTypes(), mixinTypes).get(), mixinTypeRoot.toJson()); }
@Override public JsonObject toJson() { final JsonKeys keys = keys(); return obj().key(keys.path()).opt(this.path) .key(keys.primaryType()).opt(this.primaryType) .key(keys.mixinTypes()).opt(this.mixinTypes) .get(); }
ForcedRoot implements JsonObjectConvertible, Comparable<ForcedRoot> { @Override public JsonObject toJson() { final JsonKeys keys = keys(); return obj().key(keys.path()).opt(this.path) .key(keys.primaryType()).opt(this.primaryType) .key(keys.mixinTypes()).opt(this.mixinTypes) .get(); } }
ForcedRoot implements JsonObjectConvertible, Comparable<ForcedRoot> { @Override public JsonObject toJson() { final JsonKeys keys = keys(); return obj().key(keys.path()).opt(this.path) .key(keys.primaryType()).opt(this.primaryType) .key(keys.mixinTypes()).opt(this.mixinTypes) .get(); }  }
ForcedRoot implements JsonObjectConvertible, Comparable<ForcedRoot> { @Override public JsonObject toJson() { final JsonKeys keys = keys(); return obj().key(keys.path()).opt(this.path) .key(keys.primaryType()).opt(this.primaryType) .key(keys.mixinTypes()).opt(this.mixinTypes) .get(); }  @NotNull static ForcedRoot.JsonKeys keys(); @Nullable String getPath(); void setPath(final @Nullable String path); @Nullable String getPrimaryType(); void setPrimaryType(final @Nullable String primaryType); @NotNull List<String> getMixinTypes(); void setMixinTypes(final @Nullable List<String> mixinTypes); @SuppressWarnings("WeakerAccess") ForcedRoot withPath(final @Nullable String path); @SuppressWarnings("WeakerAccess") ForcedRoot withPrimaryType(final @Nullable String primaryType); @SuppressWarnings("WeakerAccess") ForcedRoot withMixinTypes(final @NotNull String... mixinTypes); final boolean hasPath(); static @NotNull ForcedRoot fromJson(final @NotNull JsonObject json); @NotNull String[] getNamespacePrefixes(); @Override JsonObject toJson(); @Override int compareTo(final @NotNull ForcedRoot o); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString(); }
ForcedRoot implements JsonObjectConvertible, Comparable<ForcedRoot> { @Override public JsonObject toJson() { final JsonKeys keys = keys(); return obj().key(keys.path()).opt(this.path) .key(keys.primaryType()).opt(this.primaryType) .key(keys.mixinTypes()).opt(this.mixinTypes) .get(); }  @NotNull static ForcedRoot.JsonKeys keys(); @Nullable String getPath(); void setPath(final @Nullable String path); @Nullable String getPrimaryType(); void setPrimaryType(final @Nullable String primaryType); @NotNull List<String> getMixinTypes(); void setMixinTypes(final @Nullable List<String> mixinTypes); @SuppressWarnings("WeakerAccess") ForcedRoot withPath(final @Nullable String path); @SuppressWarnings("WeakerAccess") ForcedRoot withPrimaryType(final @Nullable String primaryType); @SuppressWarnings("WeakerAccess") ForcedRoot withMixinTypes(final @NotNull String... mixinTypes); final boolean hasPath(); static @NotNull ForcedRoot fromJson(final @NotNull JsonObject json); @NotNull String[] getNamespacePrefixes(); @Override JsonObject toJson(); @Override int compareTo(final @NotNull ForcedRoot o); @Override boolean equals(Object o); @Override int hashCode(); @Override String toString();  }