Interface INodeItem
-
- All Superinterfaces:
IItem
,INodeItemVisitable
,IPathSegment
- All Known Subinterfaces:
IAssemblyNodeItem
,ICycledAssemblyNodeItem
,IDefinitionNodeItem<D,I>
,IDocumentNodeItem
,IFieldNodeItem
,IFlagNodeItem
,IModelNodeItem<D,I>
,IModuleNodeItem
,IRootAssemblyNodeItem
public interface INodeItem extends IItem, IPathSegment, INodeItemVisitable
Represents a queryable Metapath model node.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Stream<? extends INodeItem>
ancestor()
Get a stream of all ancestors of this node item.default Stream<? extends INodeItem>
ancestorOrSelf()
Get a stream of this and all ancestors of this node item.static Stream<? extends INodeItem>
ancestorsOf(INodeItem item)
Get a stream of the ancestors of the provideditem
.static Stream<? extends INodeItem>
decendantsOf(INodeItem item)
Get a stream of all descendant model items of the provideditem
.default Stream<? extends INodeItem>
descendant()
Get a stream of all descendant model items of this node item.default Stream<? extends INodeItem>
descendantOrSelf()
Get a stream of this node, followed by all descendant model items of this node item.default Stream<? extends IFlagNodeItem>
flags()
Get the flags and value data associated with this node as a stream.String
format(IPathFormatter formatter)
Generate a path for this node in the directed node graph, using the provided path formatter.URI
getBaseUri()
Retrieve the base URI of this node.IFlagNodeItem
getFlagByName(String name)
Lookup a flag and value data on this node by it's effective name.Collection<? extends IFlagNodeItem>
getFlags()
Get the flags and value data associated this node.default String
getMetapath()
Get the path for this node item as a Metapath.Collection<? extends List<? extends IModelNodeItem<?,?>>>
getModelItems()
Get the model items (i.e., fields, assemblies) and value data associated this node.List<? extends IModelNodeItem<?,?>>
getModelItemsByName(String name)
Get the collection of model items associated with the instance having the providedname
.NodeItemType
getNodeItemType()
Get the type of node item this is.IModelNodeItem<?,?>
getParentContentNodeItem()
Retrieve the parent content node item if it exists.INodeItem
getParentNodeItem()
Retrieve the parent node item if it exists.default Stream<? extends INodeItem>
getPathStream()
Get a stream of path segments, starting at the root and descending.default Stream<? extends IModelNodeItem<?,?>>
modelItems()
Get the model items (i.e., fields, assemblies) and value data associated this node as a stream.static <CLASS> CLASS
toValue(INodeItem item)
Gets the value of the provided node item.-
Methods inherited from interface gov.nist.secauto.metaschema.core.metapath.item.IItem
getValue, hasValue
-
Methods inherited from interface gov.nist.secauto.metaschema.core.metapath.item.node.INodeItemVisitable
accept
-
Methods inherited from interface gov.nist.secauto.metaschema.core.metapath.format.IPathSegment
getNodeItem, getPath, toPath
-
-
-
-
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 interfaceIPathSegment
- 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
-
getNodeItemType
@NonNull NodeItemType getNodeItemType()
Get the type of node item this is.- Returns:
- the node item's type
-
getBaseUri
URI getBaseUri()
Retrieve the base URI of this node.The base URI of a node will be in order of preference:
- the base URI defined on the node
- the base URI defined on the nearest ancestor node
- the base URI defined on the document node
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 interfaceIPathSegment
- 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 provideditem
. 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 INodeItem> 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 INodeItem> decendantsOf(@NonNull INodeItem item)
Get a stream of all descendant model items of the provideditem
. 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
-
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 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 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 String name)
Get the collection of model items associated with the instance having the providedname
.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
-
-