Package manifold.api.json.codegen.schema
Class JsonSchemaType
- java.lang.Object
-
- manifold.api.json.codegen.schema.JsonSchemaType
-
- All Implemented Interfaces:
Cloneable,IJsonParentType,IJsonType
- Direct Known Subclasses:
JsonListType,JsonStructureType
public abstract class JsonSchemaType extends Object implements IJsonParentType, Cloneable
The base JSON Schema type.Attention! subclasses must take care to share state with copies. See the
JsonSchemaType.Stateclass below.
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringFIELD_FILE_URLprotected static StringFROM_SOURCE_METHOD
-
Constructor Summary
Constructors Modifier Constructor Description protectedJsonSchemaType(String name, manifold.api.fs.IFile source, JsonSchemaType parent, TypeAttributes attr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected StringaddActualNameAnnotation(StringBuilder sb, int indent, String name, boolean capitalize)protected StringaddActualNameAnnotation(StringBuilder sb, int indent, String name, boolean capitalize, boolean force)protected voidaddFromSourceMethod(StringBuilder sb, int indent)voidaddIssue(JsonIssue issue)protected voidaddRequestMethods(StringBuilder sb, int indent, String typeName)protected booleanaddSourcePositionAnnotation(StringBuilder sb, int indent, String name, manifold.json.rt.parser.Token token)protected voidaddTypeReferenceAnnotation(StringBuilder sb, int indent, JsonSchemaType type)JsonSchemaTypecopyWithAttributes(TypeAttributes attributes)booleanequals(Object o)protected StringgetActualFqn(AbstractJsonTypeManifold tm)protected StringgetConstituentQn(IJsonType constituentType, IJsonType propertyType)protected StringgetConstituentQn(IJsonType constituentType, IJsonType propertyType, boolean param)protected IJsonTypegetConstituentQnComponent(IJsonType constituentType)List<IJsonType>getDefinitions()DiagnosticListener<JavaFileObject>getErrorHandler()manifold.api.fs.IFilegetFile()StringgetFqn()protected StringgetFqn(JsonSchemaType type)StringgetIdentifier()protected manifold.api.fs.IFilegetIFile()List<JsonIssue>getIssues()StringgetLabel()JavaFileManager.LocationgetLocation()manifold.api.host.IModulegetModule()StringgetName()JsonSchemaTypegetParent()protected StringgetPropertyType(IJsonType propertyType)protected StringgetPropertyType(IJsonType propertyType, boolean qualifiedWithMe, boolean param)protected AbstractJsonTypeManifoldgetTm()manifold.json.rt.parser.TokengetToken()TypeAttributesgetTypeAttributes()inthashCode()protected voidindent(StringBuilder sb, int indent)protected booleanisCollapsedUnionEnum(IJsonType type)protected booleanisParentRoot()protected booleanisSchemaType()protected booleanisSyntheticSchema()protected StringmakeIdentifier(String name, boolean capitalize)protected StringmakeMemberIdentifier(IJsonType type)protected StringmakeTypeParameter(IJsonType type, boolean qualifiedWithMe, boolean param)protected booleanmergeInnerTypes(IJsonParentType other, IJsonParentType mergedType, Map<String,IJsonParentType> innerTypes)voidprepareToRender(JavaFileManager.Location location, manifold.api.host.IModule module, DiagnosticListener<JavaFileObject> errorHandler)exclusive to top-level types (facilitates inner class extensions)protected StringremoveGenerics(String specificPropertyType)protected voidrenderFileField(StringBuilder sb, int indent)protected voidrenderFileField(StringBuilder sb, int indent, String modifiers)voidrenderInner(AbstractJsonTypeManifold tm, StringBuilder sb, int indent, boolean mutable)voidresolveRefs()protected voidresolveRefsImpl()voidsetDefinitions(List<IJsonType> definitions)protected voidsetJsonSchema()voidsetParent(IJsonParentType parent)protected voidsetSyntheticSchema(boolean synthetic)voidsetTm(AbstractJsonTypeManifold tm)voidsetToken(manifold.json.rt.parser.Token token)-
Methods inherited from class java.lang.Object
clone, emptyArray, finalize, getClass, jailbreak, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface manifold.api.json.codegen.IJsonParentType
addChild, findChild, render
-
Methods inherited from interface manifold.api.json.codegen.IJsonType
equalsStructurally, merge
-
-
-
-
Field Detail
-
FIELD_FILE_URL
protected static final String FIELD_FILE_URL
- See Also:
- Constant Field Values
-
FROM_SOURCE_METHOD
protected static final String FROM_SOURCE_METHOD
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JsonSchemaType
protected JsonSchemaType(String name, manifold.api.fs.IFile source, JsonSchemaType parent, TypeAttributes attr)
-
-
Method Detail
-
prepareToRender
public void prepareToRender(JavaFileManager.Location location, manifold.api.host.IModule module, DiagnosticListener<JavaFileObject> errorHandler)
exclusive to top-level types (facilitates inner class extensions)- Specified by:
prepareToRenderin interfaceIJsonParentType
-
getFqn
public String getFqn()
-
getTm
protected AbstractJsonTypeManifold getTm()
-
setTm
public void setTm(AbstractJsonTypeManifold tm)
-
resolveRefs
public final void resolveRefs()
-
resolveRefsImpl
protected void resolveRefsImpl()
-
isParentRoot
protected boolean isParentRoot()
-
getFile
public manifold.api.fs.IFile getFile()
-
getLabel
public String getLabel()
-
getIdentifier
public String getIdentifier()
- Specified by:
getIdentifierin interfaceIJsonType
-
getToken
public manifold.json.rt.parser.Token getToken()
-
setToken
public void setToken(manifold.json.rt.parser.Token token)
-
getParent
public JsonSchemaType getParent()
-
setParent
public void setParent(IJsonParentType parent)
-
getDefinitions
public List<IJsonType> getDefinitions()
- Specified by:
getDefinitionsin interfaceIJsonType
-
setDefinitions
public void setDefinitions(List<IJsonType> definitions)
- Specified by:
setDefinitionsin interfaceIJsonType
-
isSchemaType
protected boolean isSchemaType()
-
setJsonSchema
protected void setJsonSchema()
-
isSyntheticSchema
protected boolean isSyntheticSchema()
-
setSyntheticSchema
protected void setSyntheticSchema(boolean synthetic)
-
getTypeAttributes
public TypeAttributes getTypeAttributes()
- Specified by:
getTypeAttributesin interfaceIJsonType
-
copyWithAttributes
public JsonSchemaType copyWithAttributes(TypeAttributes attributes)
- Specified by:
copyWithAttributesin interfaceIJsonType
-
mergeInnerTypes
protected boolean mergeInnerTypes(IJsonParentType other, IJsonParentType mergedType, Map<String,IJsonParentType> innerTypes)
-
getIssues
public List<JsonIssue> getIssues()
- Specified by:
getIssuesin interfaceIJsonParentType
-
addIssue
public void addIssue(JsonIssue issue)
- Specified by:
addIssuein interfaceIJsonParentType
-
indent
protected void indent(StringBuilder sb, int indent)
-
addFromSourceMethod
protected void addFromSourceMethod(StringBuilder sb, int indent)
-
addRequestMethods
protected void addRequestMethods(StringBuilder sb, int indent, String typeName)
-
addTypeReferenceAnnotation
protected void addTypeReferenceAnnotation(StringBuilder sb, int indent, JsonSchemaType type)
-
addSourcePositionAnnotation
protected boolean addSourcePositionAnnotation(StringBuilder sb, int indent, String name, manifold.json.rt.parser.Token token)
-
getIFile
protected manifold.api.fs.IFile getIFile()
-
addActualNameAnnotation
protected String addActualNameAnnotation(StringBuilder sb, int indent, String name, boolean capitalize)
-
addActualNameAnnotation
protected String addActualNameAnnotation(StringBuilder sb, int indent, String name, boolean capitalize, boolean force)
-
renderFileField
protected void renderFileField(StringBuilder sb, int indent)
-
renderFileField
protected void renderFileField(StringBuilder sb, int indent, String modifiers)
-
getPropertyType
protected String getPropertyType(IJsonType propertyType, boolean qualifiedWithMe, boolean param)
-
makeTypeParameter
protected String makeTypeParameter(IJsonType type, boolean qualifiedWithMe, boolean param)
-
getFqn
protected String getFqn(JsonSchemaType type)
-
getActualFqn
protected String getActualFqn(AbstractJsonTypeManifold tm)
-
getConstituentQn
protected String getConstituentQn(IJsonType constituentType, IJsonType propertyType)
-
getConstituentQn
protected String getConstituentQn(IJsonType constituentType, IJsonType propertyType, boolean param)
-
isCollapsedUnionEnum
protected boolean isCollapsedUnionEnum(IJsonType type)
-
getLocation
public JavaFileManager.Location getLocation()
-
getModule
public manifold.api.host.IModule getModule()
-
getErrorHandler
public DiagnosticListener<JavaFileObject> getErrorHandler()
-
renderInner
public void renderInner(AbstractJsonTypeManifold tm, StringBuilder sb, int indent, boolean mutable)
- Specified by:
renderInnerin interfaceIJsonParentType
-
-