Package manifold.api.json.codegen.schema
Class JsonEnumType
- java.lang.Object
-
- manifold.api.json.codegen.schema.JsonSchemaType
-
- manifold.api.json.codegen.JsonStructureType
-
- manifold.api.json.codegen.schema.JsonEnumType
-
- All Implemented Interfaces:
Cloneable,IJsonParentType,IJsonType
public class JsonEnumType extends JsonStructureType
Transform JSON Schema enum to Java enum:"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 callingmyObj.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 callingmyObj.getFoo()the value returned to Java code is always theFoo enumconst corresponding with the underlying bindings value.
-
-
Field Summary
-
Fields inherited from class manifold.api.json.codegen.schema.JsonSchemaType
FIELD_FILE_URL, FROM_SOURCE_METHOD
-
-
Constructor Summary
Constructors Constructor Description JsonEnumType(JsonEnumType enum1, JsonEnumType enum2, JsonSchemaType parent, String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IJsonTypemerge(IJsonType that)voidrender(AbstractJsonTypeManifold tm, StringBuilder sb, int indent, boolean mutable)-
Methods inherited from class manifold.api.json.codegen.JsonStructureType
addChild, addMember, addRequiredWithTokens, addSourcePositionAnnotation, addSuper, equals, equalsStructurally, findChild, getInnerTypes, getMemberLocations, getMembers, hashCode, isRequired, makeEnumType, resolveRefsImpl, toString
-
Methods inherited from class manifold.api.json.codegen.schema.JsonSchemaType
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
-
-
-
-
Constructor Detail
-
JsonEnumType
public JsonEnumType(JsonEnumType enum1, JsonEnumType enum2, JsonSchemaType parent, String name)
-
-
Method Detail
-
merge
public IJsonType merge(IJsonType that)
- Specified by:
mergein interfaceIJsonType- Overrides:
mergein classJsonStructureType
-
render
public void render(AbstractJsonTypeManifold tm, StringBuilder sb, int indent, boolean mutable)
- Specified by:
renderin interfaceIJsonParentType- Overrides:
renderin classJsonStructureType
-
-