Interface INodeItem

    • Method Detail

      • 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
      • 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
      • ancestor

        @NonNull
        default Stream<? extends INodeItemancestor()
        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 INodeItemancestorOrSelf()
        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 INodeItemancestorsOf​(@NonNull
                                                       INodeItem item)
        Get a stream of the ancestors of the provided item. The stream is ordered from the closest to farthest ancestor.
        Parameters:
        item - the target item to get ancestors for
        Returns:
        a stream of all ancestor node items
      • descendant

        @NonNull
        default Stream<? extends INodeItemdescendant()
        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 INodeItemdecendantsOf​(@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 INodeItemdescendantOrSelf()
        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
      • getFlags

        @NonNull
        Collection<? extends IFlagNodeItemgetFlags()
        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
                                    String name)
        Lookup a flag and value data on this node by it's effective name.
        Parameters:
        name - the effective name of the flag
        Returns:
        the flag with the matching effective name or null if no match was found
      • flags

        @NonNull
        default Stream<? extends IFlagNodeItemflags()
        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
                                                                      String 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