Class AbstractNodeItemFactory

java.lang.Object
dev.metaschema.core.metapath.item.node.AbstractNodeItemFactory
All Implemented Interfaces:
INodeItemFactory, INodeItemGenerator

public abstract class AbstractNodeItemFactory extends Object implements INodeItemFactory, INodeItemGenerator
A base implementation of a node item factory that creates node items for Metaschema definitions and instances.
  • Constructor Details

    • AbstractNodeItemFactory

      public AbstractNodeItemFactory()
  • Method Details

    • newDocumentNodeItem

      public IDocumentNodeItem newDocumentNodeItem(IAssemblyDefinition definition, URI documentUri, Object value)
      Description copied from interface: INodeItemFactory
      Create a new document node item for the provided definition.
      Specified by:
      newDocumentNodeItem in interface INodeItemFactory
      Parameters:
      definition - the root assembly definition to create the document item for.
      documentUri - the uniform resource identifier of the document
      value - the root item's associated data
      Returns:
      the new node item
    • newModuleNodeItem

      public IModuleNodeItem newModuleNodeItem(IModule module)
      Description copied from interface: INodeItemFactory
      Create a new Metaschema node item for the provided metaschema.
      Specified by:
      newModuleNodeItem in interface INodeItemFactory
      Parameters:
      module - the Metaschema to create the item for.
      Returns:
      the new node item
    • newFieldNodeItem

      public IFieldNodeItem newFieldNodeItem(IFieldDefinition definition, IModuleNodeItem module)
      Description copied from interface: INodeItemFactory
      Create a new IFieldNodeItem based on the provided definition, which is expected to be a global definition within the provided Metaschema.
      Specified by:
      newFieldNodeItem in interface INodeItemFactory
      Parameters:
      definition - the global definition
      module - the Metaschema containing the definition
      Returns:
      the new field node item
    • newFieldNodeItem

      public IFieldNodeItem newFieldNodeItem(IFieldDefinition definition, URI baseUri)
      Description copied from interface: INodeItemFactory
      Create a new IFieldNodeItem that is detached from a Metaschema.
      Specified by:
      newFieldNodeItem in interface INodeItemFactory
      Parameters:
      definition - the global definition
      baseUri - the base URI to use for this node item when evaluating an IMetapathExpression
      Returns:
      the new field node item
    • newFieldNodeItem

      public IFieldNodeItem newFieldNodeItem(IFieldInstance instance, IAssemblyNodeItem parent)
      Description copied from interface: INodeItemFactory
      Create a new IFieldNodeItem that is based on a Metaschema instance.

      A single instance of this item is expected to represent the possibility in a metaschema of a series of instance values.

      Specified by:
      newFieldNodeItem in interface INodeItemFactory
      Parameters:
      instance - the Metaschema field instance
      parent - the parent node item
      Returns:
      the new field node item
    • newFieldNodeItem

      public IFieldNodeItem newFieldNodeItem(IFieldInstance instance, IAssemblyNodeItem parent, int position, Object value)
      Description copied from interface: INodeItemFactory
      Create a new IFieldNodeItem that is based on a Metaschema instance with associated data.
      Specified by:
      newFieldNodeItem in interface INodeItemFactory
      Parameters:
      instance - the Metaschema field instance
      parent - the parent node item
      position - the data item's position in the sequence of data items for the instance
      value - the item's associated data
      Returns:
      the new field node item
    • newAssemblyNodeItem

      public IAssemblyNodeItem newAssemblyNodeItem(IAssemblyDefinition definition, IModuleNodeItem module)
      Description copied from interface: INodeItemFactory
      Create a new IAssemblyNodeItem based on the provided definition, which is expected to be a global definition within the provided Metaschema.
      Specified by:
      newAssemblyNodeItem in interface INodeItemFactory
      Parameters:
      definition - the global definition
      module - the Metaschema containing the definition
      Returns:
      the new assembly node item
    • newAssemblyNodeItem

      public IAssemblyNodeItem newAssemblyNodeItem(IAssemblyDefinition definition, URI baseUri)
      Description copied from interface: INodeItemFactory
      Create a new IAssemblyNodeItem that is detached from a Metaschema.
      Specified by:
      newAssemblyNodeItem in interface INodeItemFactory
      Parameters:
      definition - the global definition
      baseUri - the base URI to use for this node item when evaluating an IMetapathExpression
      Returns:
      the new assembly node item
    • newAssemblyNodeItem

      public IAssemblyNodeItem newAssemblyNodeItem(IAssemblyDefinition definition, URI baseUri, Object value)
      Description copied from interface: INodeItemFactory
      Create a new IAssemblyNodeItem that is detached from a Metaschema, with associated data.
      Specified by:
      newAssemblyNodeItem in interface INodeItemFactory
      Parameters:
      definition - the global definition
      baseUri - the base URI to use for this node item when evaluating an IMetapathExpression
      value - the associated data
      Returns:
      the new assembly node item
    • newAssemblyNodeItem

      public IAssemblyNodeItem newAssemblyNodeItem(IAssemblyInstance instance, IAssemblyNodeItem parent)
      Description copied from interface: INodeItemFactory
      Create a new IAssemblyNodeItem that is based on a Metaschema instance.

      A single instance of this item is expected to represent the possibility in a metaschema of a series of instance values.

      Specified by:
      newAssemblyNodeItem in interface INodeItemFactory
      Parameters:
      instance - the Metaschema assembly instance
      parent - the parent node item
      Returns:
      the new assembly node item
    • newAssemblyNodeItem

      public IAssemblyNodeItem newAssemblyNodeItem(IAssemblyInstance instance, IAssemblyNodeItem parent, int position, Object value)
      Description copied from interface: INodeItemFactory
      Create a new IAssemblyNodeItem that is based on a Metaschema instance with associated data.
      Specified by:
      newAssemblyNodeItem in interface INodeItemFactory
      Parameters:
      instance - the Metaschema assembly instance
      parent - the parent node item
      position - the data item's position in the sequence of data items for the instance, which is 0 based
      value - the data item's value
      Returns:
      the new assembly node item
    • newModelItem

      @NonNull protected IModelNodeItem<?,?> newModelItem(@NonNull INamedModelInstance instance, @NonNull IAssemblyNodeItem parent, int position, @NonNull Object value)
      Create a new IModelNodeItem based on the provided instance that is a child of the provided parent. This new item will have the provided value.
      Parameters:
      instance - the model instance to create the node for
      parent - the item to use as the parent item for the created node item
      position - the data item's position in the sequence of data items for the instance, which is 0 based
      value - the data item's value
      Returns:
      the created node item
    • newModelItem

      @NonNull protected IModelNodeItem<?,?> newModelItem(@NonNull INamedModelInstance instance, @NonNull IAssemblyNodeItem parent)
      Create a new IModelNodeItem based on the provided instance that is a child of the provided parent. This new item will have no associated value.
      Parameters:
      instance - the model instance to create the node for
      parent - the item to use as the parent item for the created node item
      Returns:
      the created node item
    • getNamedModelInstances

      @NonNull protected Stream<? extends INamedModelInstance> getNamedModelInstances(@NonNull IContainerModelAbsolute container)
      Get the descendant model instances of the provided container.
      Parameters:
      container - the container to get descendant instances for
      Returns:
      the stream of descendant instances
    • getValuedModelInstances

      @NonNull protected Stream<? extends IModelInstance> getValuedModelInstances(@NonNull IContainerModelAbsolute container)
      Get the descendant model instances of the provided container.
      Parameters:
      container - the container to get descendant instances for
      Returns:
      the stream of descendant instances