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,
String name) |
Modifier and Type | Method and Description |
---|---|
IJsonType |
merge(IJsonType that) |
void |
render(AbstractJsonTypeManifold tm,
StringBuilder sb,
int indent,
boolean mutable) |
addChild, addMember, addRequiredWithTokens, addSourcePositionAnnotation, addSuper, equals, equalsStructurally, findChild, getInnerTypes, getMemberLocations, getMembers, hashCode, isRequired, makeEnumType, resolveRefsImpl, toString
addActualNameAnnotation, 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, setToken
public JsonEnumType(JsonEnumType enum1, JsonEnumType enum2, JsonSchemaType parent, String name)
public IJsonType merge(IJsonType that)
merge
in interface IJsonType
merge
in class JsonStructureType
public void render(AbstractJsonTypeManifold tm, StringBuilder sb, int indent, boolean mutable)
render
in interface IJsonParentType
render
in class JsonStructureType
Copyright © 2024. All rights reserved.