Interface INodeItem

All Superinterfaces:
ICollectionValue, IItem, IMetapathQueryable, INodeItemVisitable, IPathSegment
All Known Subinterfaces:
IAssemblyInstanceGroupedNodeItem, IAssemblyNodeItem, IAtomicValuedNodeItem, ICycledAssemblyNodeItem, IDefinitionNodeItem<D,I>, IDocumentBasedNodeItem, IDocumentNodeItem, IFeatureChildNodeItem, IFeatureFlagContainerItem, IFeatureModelContainerItem, IFeatureOrhpanedDefinitionNodeItem<D,I>, IFieldNodeItem, IFlagNodeItem, IModelNodeItem<D,I>, IModuleNodeItem, IRootAssemblyNodeItem
All Known Implementing Classes:
AbstractDefinitionNodeItem, AbstractFlagInstanceNodeItem, AbstractGlobalDefinitionNodeItem, AbstractInstanceNodeItem, AbstractNodeItem, AbstractOrphanedDefinitionNodeItem

public interface INodeItem extends IItem, IPathSegment, INodeItemVisitable
Represents a Metapath model node.
  • Method Details

    • getNodeType

      @NonNull INodeItem.NodeType getNodeType()
      Get the node type for the node item.
      Returns:
      the node type
    • type

      @NonNull static IItemType type()
      Get the static type information of the node item.
      Returns:
      the item type
    • getPosition

      default int getPosition()
      Retrieve the relative position of this node relative to sibling nodes.

      A singleton item in a sequence will have a position value of 1.

      The value 1 is used as the starting value to align with the XPath specification.

      Returns:
      a positive integer value designating this instance's position within a collection
    • format

      String format(IPathFormatter formatter)
      Generate a path for this node in the directed node graph, using the provided path formatter.
      Specified by:
      format in interface IPathSegment
      Parameters:
      formatter - the path formatter
      Returns:
      a textual representation of the path segment
    • toValue

      @NonNull static <CLASS> CLASS toValue(@NonNull INodeItem item)
      Gets the value of the provided node item.

      If the provided node item is a document, this method get the first child node item's value, since a document doesn't have a value.

      Type Parameters:
      CLASS - the type of the bound object to return
      Parameters:
      item - the node item to get the value of
      Returns:
      a bound object
      Throws:
      NullPointerException - if the node item has no associated value
    • getParentNodeItem

      INodeItem getParentNodeItem()
      Retrieve the parent node item if it exists.
      Returns:
      the parent node item, or null if this node item has no known parent
    • getParentContentNodeItem

      IModelNodeItem<?,?> getParentContentNodeItem()
      Retrieve the parent content node item if it exists. A content node is a non-document node.
      Returns:
      the parent content node item, or null if this node item has no known parent content node item
    • getNodeItemKind

      @NonNull NodeItemKind getNodeItemKind()
      Get the kind of node item this is.
      Returns:
      the node item's kind
    • getBaseUri

      URI getBaseUri()
      Retrieve the base URI of this node.

      The base URI of a node will be in order of preference:

      1. the base URI defined on the node
      2. the base URI defined on the nearest ancestor node
      3. the base URI defined on the document node
      4. null if the document node is unknown
      Returns:
      the base URI or null if it is unknown
    • getMetapath

      @NonNull default String getMetapath()
      Get the path for this node item as a Metapath.
      Returns:
      the Metapath
    • getPathStream

      default Stream<? extends INodeItem> getPathStream()
      Description copied from interface: IPathSegment
      Get a stream of path segments, starting at the root and descending.
      Specified by:
      getPathStream in interface IPathSegment
      Returns:
      a stream of path segments in descending order
    • ancestor

      @NonNull default Stream<? extends INodeItem> ancestor()
      Get a stream of all ancestors of this node item. The stream is ordered from closest to farthest ancestor.
      Returns:
      a stream of ancestor node items
    • ancestorOrSelf

      @NonNull default Stream<? extends INodeItem> ancestorOrSelf()
      Get a stream of this and all ancestors of this node item. The stream is ordered from self, then closest to farthest ancestor.
      Returns:
      a stream of this node followed by all ancestor node items
    • ancestorsOf

      @NonNull static Stream<? extends INodeItem> ancestorsOf(@NonNull INodeItem item)
      Get a stream of the ancestors of the provided item. The stream is ordered from the farthest ancestor to the closest.
      Parameters:
      item - the target item to get ancestors for
      Returns:
      a stream of all ancestor node items
    • descendant

      @NonNull default Stream<? extends IModelNodeItem<?,?>> descendant()
      Get a stream of all descendant model items of this node item. The stream is ordered from closest to farthest descendants in a depth-first order.
      Returns:
      a stream of descendant node items
    • decendantsOf

      @NonNull static Stream<? extends IModelNodeItem<?,?>> decendantsOf(@NonNull INodeItem item)
      Get a stream of all descendant model items of the provided item. The stream is ordered from closest to farthest descendants in a depth-first order.
      Parameters:
      item - the target item to get descendants for
      Returns:
      a stream of descendant node items
    • descendantOrSelf

      @NonNull default Stream<? extends INodeItem> descendantOrSelf()
      Get a stream of this node, followed by all descendant model items of this node item. The stream is ordered from closest to farthest descendants in a depth-first order.
      Returns:
      a stream of this node and descendant node items
    • followingSibling

      @NonNull default Stream<? extends IModelNodeItem<?,?>> followingSibling()
      Get the children of this node's parent that occur after this node in a depth-first order.
      Returns:
      a stream of nodes
    • precedingSibling

      @NonNull default Stream<? extends IModelNodeItem<?,?>> precedingSibling()
      Get the children of this node's parent, and their descendants, that occur before this node in a depth-first order.
      Returns:
      a stream of nodes
    • following

      default Stream<? extends IModelNodeItem<?,?>> following()
      Get the children of this node's parent, and their descendants, that occur before this node in a depth-first order.
      Returns:
      a stream of nodes
    • preceding

      default Stream<? extends IModelNodeItem<?,?>> preceding()
      Get the children of this node's parent, and their descendants, that occur after this node in a depth-first order.
      Returns:
      a stream of nodes
    • getFlags

      @NonNull Collection<? extends IFlagNodeItem> getFlags()
      Get the flags and value data associated this node. The resulting collection is expected to be ordered, with the results in document order.

      The resulting collection may be modified, but such modification is not thread safe

      Returns:
      a collection of flags
    • getFlagByName

      @Nullable IFlagNodeItem getFlagByName(@NonNull IEnhancedQName name)
      Lookup a flag and value data on this node by it's effective qualified name.
      Parameters:
      name - the effective qualified name of the flag
      Returns:
      the flag with the matching effective name or null if no match was found
    • flags

      @NonNull default Stream<? extends IFlagNodeItem> flags()
      Get the flags and value data associated with this node as a stream.
      Returns:
      the stream of flags or an empty stream if none exist
    • getModelItems

      @NonNull Collection<? extends List<? extends IModelNodeItem<?,?>>> getModelItems()
      Get the model items (i.e., fields, assemblies) and value data associated this node. A given model instance can be multi-valued, so the value of each instance will be a list. The resulting collection is expected to be ordered, with the results in document order.

      The resulting collection may be modified, but such modification is not thread safe

      Returns:
      a collection of list(s), with each list containing the items for a given model instance
    • getModelItemsByName

      @NonNull List<? extends IModelNodeItem<?,?>> getModelItemsByName(@NonNull IEnhancedQName name)
      Get the collection of model items associated with the instance having the provided name.

      The resulting collection may be modified, but such modification is not thread safe

      Parameters:
      name - the instance name to get model items for
      Returns:
      the sequence of items associated with the named model instance, or an empty list if an instance with that name is not present
    • modelItems

      @NonNull default Stream<? extends IModelNodeItem<?,?>> modelItems()
      Get the model items (i.e., fields, assemblies) and value data associated this node as a stream.
      Returns:
      the stream of model items or an empty stream if none exist
    • getLocation

      @Nullable IResourceLocation getLocation()
      Get the resource location information for the node, if known.
      Returns:
      the resource location information, or null if not known
    • stringValue

      @NonNull String stringValue()
      Get the string value of the node.
      Returns:
      the string value of the node or an empty string if it has no value.
    • getStaticContext

      @NonNull StaticContext getStaticContext()
      Get the static context to use to query this node item.
      Returns:
      the static context
    • accept

      default void accept(IItemVisitor visitor)
      Description copied from interface: IItem
      A visitor callback used to visit a variety of Metapath item types.
      Specified by:
      accept in interface IItem
      Parameters:
      visitor - the visitor to call back