Class ModuleIndex.DefinitionEntry

java.lang.Object
dev.metaschema.schemagen.ModuleIndex.DefinitionEntry
Enclosing class:
ModuleIndex

public static class ModuleIndex.DefinitionEntry extends Object
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

    Constructors
    Constructor
    Description
    Constructs a new definition entry for the specified definition.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Adds a reference to this definition from the specified instance.
    Retrieves the definition associated with this entry.
    Retrieves all instances that reference this definition.
    boolean
    Checks if this definition is a member of a choice group.
    boolean
    Checks if this definition has sibling elements in a choice group.
    boolean
    Checks if this definition should be inlined in the generated schema.
    boolean
    Checks if this definition is referenced by any instance or is a root definition.
    boolean
    Checks if this definition is a root assembly definition.
    boolean
    Checks if this definition is used within a choice group.
    boolean
    Checks if any reference to this definition uses a JSON key flag.
    boolean
    Checks if this definition is used without a JSON key flag or is a flag definition.
    boolean
    Checks if this definition has been visited during indexing.
    void
    Marks this definition as having sibling elements in a choice group.
    void
    Marks this definition as being inlined in the generated schema.
    void
    Marks this definition as being used within a choice group.
    void
    Marks this definition as having been visited during indexing.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DefinitionEntry

      public DefinitionEntry(@NonNull IDefinition definition)
      Constructs a new definition entry for the specified definition.
      Parameters:
      definition - the definition this entry represents
  • Method Details

    • getDefinition

      @NonNull public IDefinition 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:
      true if the definition is a root assembly, false otherwise
    • isReferenced

      public boolean isReferenced()
      Checks if this definition is referenced by any instance or is a root definition.
      Returns:
      true if the definition has references or is a root, false otherwise
    • getReferences

      public Set<INamedInstance> getReferences()
      Retrieves all instances that reference this definition.
      Returns:
      a set of referencing instances
    • addReference

      public boolean addReference(@NonNull INamedInstance reference)
      Adds a reference to this definition from the specified instance.
      Parameters:
      reference - the instance referencing this definition
      Returns:
      true if the reference was added, false if 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:
      true if the definition was visited, false otherwise
    • 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:
      true if the definition is inlined, false otherwise
    • 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:
      true if the definition is used as a choice, false otherwise
    • 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:
      true if the definition is a choice sibling, false otherwise
    • isUsedAsJsonKey

      public boolean isUsedAsJsonKey()
      Checks if any reference to this definition uses a JSON key flag.
      Returns:
      true if any reference has a JSON key, false otherwise
    • isUsedWithoutJsonKey

      public boolean isUsedWithoutJsonKey()
      Checks if this definition is used without a JSON key flag or is a flag definition.
      Returns:
      true if the definition is a flag or has any references without a JSON key, false otherwise
    • isChoiceGroupMember

      public boolean isChoiceGroupMember()
      Checks if this definition is a member of a choice group.
      Returns:
      true if any reference is a grouped model instance, false otherwise