Interface IItem

All Superinterfaces:
ICollectionValue
All Known Subinterfaces:
IAnyAtomicItem, IAnyUriItem, IArrayItem<ITEM>, IAssemblyInstanceGroupedNodeItem, IAssemblyNodeItem, IAtomicValuedItem, IAtomicValuedNodeItem, IBase64BinaryItem, dev.metaschema.core.metapath.item.atomic.impl.IBinaryItem, IBooleanItem, ICalendarTemporalItem, ICycledAssemblyNodeItem, IDateItem, IDateTimeItem, IDateTimeWithTimeZoneItem, IDateWithTimeZoneItem, IDayTimeDurationItem, IDecimalItem, IDefinitionNodeItem<D,I>, IDocumentBasedNodeItem, IDocumentNodeItem, IDurationItem, IEmailAddressItem, IFeatureChildNodeItem, IFeatureFlagContainerItem, IFeatureModelContainerItem, IFeatureNoDataAtomicValuedItem, IFeatureNoDataValuedItem, IFeatureOrhpanedDefinitionNodeItem<D,I>, IFieldNodeItem, IFlagNodeItem, IFunction, IHexBinaryItem, IHostnameItem, IIntegerItem, IIPAddressItem, IIPv4AddressItem, IIPv6AddressItem, IMapItem<VALUE>, IMarkupItem, IMarkupLineItem, IMarkupMultilineItem, IModelNodeItem<D,I>, IModuleNodeItem, INcNameItem, INodeItem, INonNegativeIntegerItem, INumericItem, IPositiveIntegerItem, IQNameItem, IRootAssemblyNodeItem, IStringItem, ITemporalItem, ITimeItem, ITimeWithTimeZoneItem, ITokenItem, IUntypedAtomicItem, IUriReferenceItem, IUuidItem, IYearMonthDurationItem
All Known Implementing Classes:
AbstractAnyAtomicItem, AbstractAtomicItemBase, AbstractDefinitionNodeItem, AbstractFlagInstanceNodeItem, dev.metaschema.core.metapath.function.impl.AbstractFunction, AbstractGlobalDefinitionNodeItem, AbstractInstanceNodeItem, AbstractNodeItem, AbstractOrphanedDefinitionNodeItem, AbstractUntypedAtomicItem, DefaultFunction, NullJavaTypeAdapter.VoidItem

public interface IItem extends ICollectionValue
The base interface inherited by all Metapath item implementations.
  • Method Details

    • type

      @NonNull static IItemType type()
      Get the type information for this item.
      Returns:
      the type information
    • getType

      @NonNull IItemType getType()
      Get the type information for the item.
      Returns:
      the item's type information
    • getValue

      Object getValue()
      Get the item's "wrapped" value. This "wrapped" value may be:
      • In the case of an Assembly, a Java object representing the fields and flags of the assembly.
      • In the case of a Field with flags, a Java object representing the field value and flags of the field.
      • In the case of a Field without flags or a flag, a Java type managed by a IDataTypeAdapter or a primitive type provided by the Java standard library.
      Returns:
      the value or null if the item has no available value
    • hasValue

      default boolean hasValue()
      Determine if the item has an associated value.
      Returns:
      true if the item has a non-null value or false otherwise
    • toSequence

      default ISequence<?> toSequence()
      Description copied from interface: ICollectionValue
      Get the collection value as a sequence.

      If the value is already a sequence, the value is returned as a sequence. Otherwise, if the value is an item, a new sequence will be created containing only that item.

      Specified by:
      toSequence in interface ICollectionValue
      Returns:
      the resulting sequence
    • toAtomicItem

      IAnyAtomicItem toAtomicItem()
      Get the atomic value for the item. This may be the same item if the item is an instance of IAnyAtomicItem.

      An implementation of item atomization.

      Returns:
      the atomic value or null if the item has no available value
      Throws:
      InvalidTypeFunctionException - with code InvalidTypeFunctionException.NODE_HAS_NO_TYPED_VALUE if the item does not have a typed value
    • atomize

      default Stream<IAnyAtomicItem> atomize()
      Produce a stream of atomic items based on the atomic value of these items.

      Supports item atomization.

      Specified by:
      atomize in interface ICollectionValue
      Returns:
      a stream of atomized atomic items.
      Throws:
      InvalidTypeFunctionException - with code InvalidTypeFunctionException.NODE_HAS_NO_TYPED_VALUE if the item does not have a typed value
    • flatten

      default Stream<? extends IItem> flatten()
      Description copied from interface: ICollectionValue
      Get the stream of items for the collection value.

      If the collection value contains items, then these items are returned.

      Specified by:
      flatten in interface ICollectionValue
      Returns:
      a stream of related items
    • accept

      void accept(@NonNull IItemVisitor visitor)
      A visitor callback used to visit a variety of Metapath item types.
      Parameters:
      visitor - the visitor to call back
    • contentsAsSequence

      default ISequence<?> contentsAsSequence()
      Description copied from interface: ICollectionValue
      Get the collection value as a sequence.

      If the value is already a sequence, the value is returned as a sequence. Otherwise, if the value is an item, what is returned depends on the item type:

      • IArrayItem or IMapItem: the contents of the returned sequence are the items of the array or map. Any member values that are a sequence are flattened.
      • Any other item: A singleton sequence is returned containing the item.
      Specified by:
      contentsAsSequence in interface ICollectionValue
      Returns:
      the resulting sequence