Class AbstractGlobalDefinition<MODULE extends IModule,INSTANCE extends INamedInstance>

java.lang.Object
dev.metaschema.core.model.AbstractGlobalDefinition<MODULE,INSTANCE>
Type Parameters:
MODULE - the Java type of the containing module
INSTANCE - the expected Java type of an instance of this definition
All Implemented Interfaces:
IFeatureValueConstrained, IValueConstrained, IAttributable, IDefaultable, IDefinition, IDescribable, IJsonNamed, IModelElement, IModelElementVisitable, INamed, INamedModelElement
Direct Known Subclasses:
AbstractGlobalAssemblyDefinition, AbstractGlobalFieldDefinition, AbstractGlobalFlagDefinition

public abstract class AbstractGlobalDefinition<MODULE extends IModule,INSTANCE extends INamedInstance> extends Object implements IDefinition
A base class for definitions defined globally within a Metaschema module.
  • Constructor Details

    • AbstractGlobalDefinition

      protected AbstractGlobalDefinition(@NonNull MODULE module, @NonNull AbstractGlobalDefinition.NameInitializer initializer)
      Construct a new global definition.
      Parameters:
      module - the parent module containing this instance
      initializer - the callback used to generate qualified names
  • Method Details

    • getContainingModule

      public final MODULE getContainingModule()
      Description copied from interface: IModelElement
      Retrieves the Metaschema module that contains the information element's declaration.
      Specified by:
      getContainingModule in interface IModelElement
      Returns:
      the Metaschema module
    • getSource

      public ISource getSource()
      Description copied from interface: IValueConstrained
      Get information about the resource the constraints were loaded from.
      Specified by:
      getSource in interface IValueConstrained
      Returns:
      the source information
    • getQName

      public final IEnhancedQName getQName()
      Description copied from interface: INamed
      Get the unique XML qualified name for this model element.

      The qualified name is considered to be unique relative to all sibling elements. For a flag, this name will be unique among all flag instances on the same field or assembly definition. For a field or assembly, this name will be unique among all sibling field or assembly instances on the same assembly definition.

      Multiple calls to this method are expected to produce the same, deterministic return value.

      If the namespace is not specified, then the resulting QName will have the namespace XMLConstants.NULL_NS_URI.

      This implementation may be overridden by implementation that cache the QName or provide for a more efficient method for QName creation.

      Specified by:
      getQName in interface INamed
      Returns:
      the XML qualified name, or null if there isn't one
    • getDefinitionQName

      public final IEnhancedQName getDefinitionQName()
      Description copied from interface: IDefinition
      The qualified name for the definition.

      This name is the combination of the definition's namespace, which is the module's namespace, and the definition's name.

      Specified by:
      getDefinitionQName in interface IDefinition
      Returns:
      the definition's qualified name
    • isInline

      public boolean isInline()
      Description copied from interface: IDefinition
      Determine if the definition is defined inline, meaning the definition is declared where it is used.

      If this method returns false, then IDefinition.getInlineInstance() must return null.

      Specified by:
      isInline in interface IDefinition
      Returns:
      true if the definition is declared inline or false if the definition is able to be globally referenced
      See Also:
    • getInlineInstance

      public final INSTANCE getInlineInstance()
      Description copied from interface: IDefinition
      If IDefinition.isInline() is true, return the instance the definition is inlined for.

      If this method returns null, then IDefinition.getInlineInstance() must return false.

      Specified by:
      getInlineInstance in interface IDefinition
      Returns:
      the instance or null otherwise
      See Also: