Interface 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, IItem, IMapItem<VALUE>, IMarkupItem, IMarkupLineItem, IMarkupMultilineItem, IModelNodeItem<D,I>, IModuleNodeItem, INcNameItem, INodeItem, INonNegativeIntegerItem, INumericItem, IPositiveIntegerItem, IQNameItem, IRootAssemblyNodeItem, ISequence<ITEM>, 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 ICollectionValue
A data value that can be a value in a Metapath array or map.
  • Method Details

    • toSequence

      @NonNull default ISequence<?> toSequence()
      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.

      Returns:
      the resulting sequence
    • contentsAsSequence

      @NonNull ISequence<?> contentsAsSequence()
      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.
      Returns:
      the resulting sequence
    • normalizeAsItems

      @NonNull static Stream<? extends IItem> normalizeAsItems(@NonNull ICollectionValue value)
      Get the stream of items for the collection value.

      If the collection value is a sequence, then the items in the collection are returned.

      Parameters:
      value - the collection value
      Returns:
      the sequence of related items
    • atomize

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

      Supports item atomization.

      Returns:
      a stream of atomized atomic items.
    • flatten

      @NonNull Stream<? extends IItem> flatten()
      Get the stream of items for the collection value.

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

      Returns:
      a stream of related items
    • deepEquals

      boolean deepEquals(@Nullable ICollectionValue other, @NonNull DynamicContext dynamicContext)
      Determine if this and the other value are deeply equal.

      Item equality is defined by the XPath 3.1 fn:deep-equal specification.

      Parameters:
      other - the other value to compare to this value to
      dynamicContext - used to provide evaluation information, including the implicit timezone
      Returns:
      the true if the two values are equal, or false otherwise
    • toSignature

      @NonNull String toSignature()
      Get a representation of the value based on its type signature.
      Returns:
      the signature
    • distinctByDeepEquals

      static Predicate<? super ICollectionValue> distinctByDeepEquals(@NonNull DynamicContext dynamicContext)
      Provides a Predicate which filters items in a stream returning distinct values based on deepEquals(ICollectionValue, DynamicContext).
      Parameters:
      dynamicContext - used to provide evaluation information, including the implicit timezone
      Returns:
      the predicate
    • distinctByDeepEquals

      static <T extends ICollectionValue> Predicate<? super T> distinctByDeepEquals(@NonNull Class<T> clazz, @NonNull DynamicContext dynamicContext)
      Provides a Predicate which filters items in a stream returning distinct values based on deepEquals(ICollectionValue, DynamicContext).
      Type Parameters:
      T - the Java type of the values filtered
      Parameters:
      clazz - the Java class for the type handled by the predicate
      dynamicContext - used to provide evaluation information, including the implicit timezone
      Returns:
      the predicate