java.lang.Object
dev.metaschema.schemagen.ModuleIndex.DefinitionEntry
- Enclosing class:
- ModuleIndex
Represents an entry in the module index for a single definition.
Each entry tracks usage information about a definition including its references, inline status, and how it is used within choice groups.
-
Constructor Summary
ConstructorsConstructorDescriptionDefinitionEntry(IDefinition definition) Constructs a new definition entry for the specified definition. -
Method Summary
Modifier and TypeMethodDescriptionbooleanaddReference(INamedInstance reference) Adds a reference to this definition from the specified instance.Retrieves the definition associated with this entry.Retrieves all instances that reference this definition.booleanChecks if this definition is a member of a choice group.booleanChecks if this definition has sibling elements in a choice group.booleanisInline()Checks if this definition should be inlined in the generated schema.booleanChecks if this definition is referenced by any instance or is a root definition.booleanisRoot()Checks if this definition is a root assembly definition.booleanChecks if this definition is used within a choice group.booleanChecks if any reference to this definition uses a JSON key flag.booleanChecks if this definition is used without a JSON key flag or is a flag definition.booleanChecks if this definition has been visited during indexing.voidMarks this definition as having sibling elements in a choice group.voidMarks this definition as being inlined in the generated schema.voidMarks this definition as being used within a choice group.voidMarks this definition as having been visited during indexing.
-
Constructor Details
-
DefinitionEntry
Constructs a new definition entry for the specified definition.- Parameters:
definition- the definition this entry represents
-
-
Method Details
-
getDefinition
Retrieves the definition associated with this entry.- Returns:
- the definition
-
isRoot
public boolean isRoot()Checks if this definition is a root assembly definition.- Returns:
trueif the definition is a root assembly,falseotherwise
-
isReferenced
public boolean isReferenced()Checks if this definition is referenced by any instance or is a root definition.- Returns:
trueif the definition has references or is a root,falseotherwise
-
getReferences
Retrieves all instances that reference this definition.- Returns:
- a set of referencing instances
-
addReference
Adds a reference to this definition from the specified instance.- Parameters:
reference- the instance referencing this definition- Returns:
trueif the reference was added,falseif it already existed
-
markVisited
public void markVisited()Marks this definition as having been visited during indexing. -
isVisited
public boolean isVisited()Checks if this definition has been visited during indexing.- Returns:
trueif the definition was visited,falseotherwise
-
markInline
public void markInline()Marks this definition as being inlined in the generated schema. -
isInline
public boolean isInline()Checks if this definition should be inlined in the generated schema.- Returns:
trueif the definition is inlined,falseotherwise
-
markUsedAsChoice
public void markUsedAsChoice()Marks this definition as being used within a choice group. -
isUsedAsChoice
public boolean isUsedAsChoice()Checks if this definition is used within a choice group.- Returns:
trueif the definition is used as a choice,falseotherwise
-
markAsChoiceSibling
public void markAsChoiceSibling()Marks this definition as having sibling elements in a choice group. -
isChoiceSibling
public boolean isChoiceSibling()Checks if this definition has sibling elements in a choice group.- Returns:
trueif the definition is a choice sibling,falseotherwise
-
isUsedAsJsonKey
public boolean isUsedAsJsonKey()Checks if any reference to this definition uses a JSON key flag.- Returns:
trueif any reference has a JSON key,falseotherwise
-
isUsedWithoutJsonKey
public boolean isUsedWithoutJsonKey()Checks if this definition is used without a JSON key flag or is a flag definition.- Returns:
trueif the definition is a flag or has any references without a JSON key,falseotherwise
-
isChoiceGroupMember
public boolean isChoiceGroupMember()Checks if this definition is a member of a choice group.- Returns:
trueif any reference is a grouped model instance,falseotherwise
-