public class JsonEnumType extends JsonStructureType
"enum": ["blue", "green", 5, 4.0]
enum Foo implements IBindingType {
blue("blue"),
green("green"),
_5(5),
_4_0(4.0);
private final Object _value;
Foo(Object value) {
_value = value;
}
@Override
public Object toBindingValue() {
return _value;
}
}
When calling myObj.setFoo(MyObj.Foo.blue) the JSON manifold marshals the value corresponding with
the Java enum const so that the JSON bindings always contains JSON values. Similarly upon calling
myObj.getFoo() the value returned to Java code is always the Foo enum const corresponding with the
underlying bindings value.FIELD_FILE_URL, FROM_SOURCE_METHOD| Constructor and Description |
|---|
JsonEnumType(JsonEnumType enum1,
JsonEnumType enum2,
JsonSchemaType parent,
java.lang.String name) |
| Modifier and Type | Method and Description |
|---|---|
IJsonType |
merge(IJsonType that) |
void |
render(AbstractJsonTypeManifold tm,
java.lang.StringBuilder sb,
int indent,
boolean mutable) |
addChild, addMember, addRequiredWithTokens, addSourcePositionAnnotation, addSuper, equals, equalsStructurally, findChild, getInnerTypes, getMemberLocations, getMembers, hashCode, isRequired, makeEnumType, resolveRefsImpl, toStringaddActualNameAnnotation, addActualNameAnnotation, addFromSourceMethod, addIssue, addRequestMethods, addSourcePositionAnnotation, addTypeReferenceAnnotation, copyWithAttributes, getActualFqn, getConstituentQn, getConstituentQn, getConstituentQnComponent, getDefinitions, getErrorHandler, getFile, getFqn, getFqn, getIdentifier, getIFile, getIssues, getLabel, getLocation, getModule, getName, getParent, getPropertyType, getPropertyType, getTm, getToken, getTypeAttributes, indent, isCollapsedUnionEnum, isParentRoot, isSchemaType, isSyntheticSchema, makeIdentifier, makeMemberIdentifier, makeTypeParameter, mergeInnerTypes, prepareToRender, removeGenerics, renderFileField, renderFileField, renderInner, resolveRefs, setDefinitions, setJsonSchema, setParent, setSyntheticSchema, setTm, setTokenpublic JsonEnumType(JsonEnumType enum1, JsonEnumType enum2, JsonSchemaType parent, java.lang.String name)
public IJsonType merge(IJsonType that)
merge in interface IJsonTypemerge in class JsonStructureTypepublic void render(AbstractJsonTypeManifold tm, java.lang.StringBuilder sb, int indent, boolean mutable)
render in interface IJsonParentTyperender in class JsonStructureTypeCopyright © 2021. All rights reserved.