Module dev.metaschema.core
Interface IArrayItem<ITEM extends ICollectionValue>
- Type Parameters:
ITEM- the Metapath item type of array members
- All Superinterfaces:
Collection<ITEM>,ICollectionValue,IFunction,IItem,Iterable<ITEM>,List<ITEM>
A representation of a Metapath array item type.
Instances of this interface are required to enforce non-mutability for array contents.
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.metaschema.core.metapath.function.IFunction
IFunction.Builder, IFunction.FunctionProperty -
Method Summary
Modifier and TypeMethodDescriptiondefault voidaccept(IItemVisitor visitor) A visitor callback used to visit a variety of Metapath item types.default Stream<IAnyAtomicItem>atomize()Produce a stream of atomic items based on the atomic value of these items.default booleandefault booleancontainsAll(Collection<?> collection) default ISequence<?>Get the collection value as a sequence.static <T extends ICollectionValue>
IArrayItem<T>copyOf(Collection<? extends T> collection) Returns an unmodifiable array item containing the items of the given Collection, in its iteration order.static <T extends ICollectionValue>
IArrayItem<T>empty()Get an empty, immutable array item.flatten()Get the stream of items for the collection value.default ITEMget(int index) default IItemTypegetType()Get the type information for the item.getValue()Get the item's "wrapped" value.default booleanhasValue()Determine if the item has an associated value.default intdefault booleanisEmpty()Determine if this sequence is empty.default intlastIndexOf(Object obj) default ListIterator<ITEM>default ListIterator<ITEM>listIterator(int index) static <T extends ICollectionValue>
IArrayItem<T>of()Returns an unmodifiable array item containing zero elements.static <T extends ICollectionValue>
IArrayItem<T>of(T e1) Returns an unmodifiable array item containing one item.static <T extends ICollectionValue>
IArrayItem<T>of(T... items) Returns an unmodifiable array item containing an arbitrary number of items.static <T extends ICollectionValue>
IArrayItem<T>of(T e1, T e2) Returns an unmodifiable array item containing two items.static <T extends ICollectionValue>
IArrayItem<T>of(T e1, T e2, T e3) Returns an unmodifiable array item containing three elements.static <T extends ICollectionValue>
IArrayItem<T>of(T e1, T e2, T e3, T e4) Returns an unmodifiable array item containing four items.static <T extends ICollectionValue>
IArrayItem<T>of(T e1, T e2, T e3, T e4, T e5) Returns an unmodifiable array item containing five items.static <T extends ICollectionValue>
IArrayItem<T>of(T e1, T e2, T e3, T e4, T e5, T e6) Returns an unmodifiable array item containing six items.static <T extends ICollectionValue>
IArrayItem<T>of(T e1, T e2, T e3, T e4, T e5, T e6, T e7) Returns an unmodifiable array item containing seven items.static <T extends ICollectionValue>
IArrayItem<T>of(T e1, T e2, T e3, T e4, T e5, T e6, T e7, T e8) Returns an unmodifiable array item containing eight items.static <T extends ICollectionValue>
IArrayItem<T>of(T e1, T e2, T e3, T e4, T e5, T e6, T e7, T e8, T e9) Returns an unmodifiable array item containing nine items.static <T extends ICollectionValue>
IArrayItem<T>of(T e1, T e2, T e3, T e4, T e5, T e6, T e7, T e8, T e9, T e10) Returns an unmodifiable array item containing ten items.static <T extends ICollectionValue>
IArrayItem<T>ofCollection(List<T> items) Get a new, immutable array item that contains the items in the provided list.default intsize()Get the count of items in this sequence.subList(int fromIndex, int toIndex) default Object[]toArray()default <T> T[]toArray(T[] array) static <T extends ICollectionValue>
Collector<T,?, IArrayItem<T>> ACollectorimplementation to generates a sequence from a stream of Metapath items.default ISequence<? extends IArrayItem<ITEM>>Get the collection value as a sequence.static IItemTypetype()Get the type information for this item.Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface dev.metaschema.core.metapath.function.IFunction
arity, deepEquals, execute, getArguments, getName, getProperties, getQName, getResult, isArityUnbounded, isContextDepenent, isDeterministic, isFocusDependent, isNamedFunction, toAtomicItem, toSignature
-
Method Details
-
type
Get the type information for this item.- Returns:
- the type information
-
getType
Description copied from interface:IItemGet the type information for the item. -
empty
Get an empty, immutable array item.- Type Parameters:
T- the item Java type- Returns:
- an immutable map item
-
getValue
Description copied from interface:IItemGet 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
IDataTypeAdapteror a primitive type provided by the Java standard library.
-
hasValue
default boolean hasValue()Description copied from interface:IItemDetermine if the item has an associated value. -
contentsAsSequence
Description copied from interface:ICollectionValueGet 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:
IArrayItemorIMapItem: 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:
contentsAsSequencein interfaceICollectionValue- Specified by:
contentsAsSequencein interfaceIItem- Returns:
- the resulting sequence
-
atomize
Description copied from interface:IItemProduce a stream of atomic items based on the atomic value of these items.Supports item atomization.
- Specified by:
atomizein interfaceICollectionValue- Specified by:
atomizein interfaceIItem- Returns:
- a stream of atomized atomic items.
-
isEmpty
default boolean isEmpty()Determine if this sequence is empty.- Specified by:
isEmptyin interfaceCollection<ITEM extends ICollectionValue>- Specified by:
isEmptyin interfaceList<ITEM extends ICollectionValue>- Returns:
trueif the sequence contains no items, orfalseotherwise
-
size
default int size()Get the count of items in this sequence.- Specified by:
sizein interfaceCollection<ITEM extends ICollectionValue>- Specified by:
sizein interfaceList<ITEM extends ICollectionValue>- Returns:
- the count of items
-
contains
- Specified by:
containsin interfaceCollection<ITEM extends ICollectionValue>- Specified by:
containsin interfaceList<ITEM extends ICollectionValue>
-
toArray
- Specified by:
toArrayin interfaceCollection<ITEM extends ICollectionValue>- Specified by:
toArrayin interfaceList<ITEM extends ICollectionValue>
-
toArray
default <T> T[] toArray(T[] array) - Specified by:
toArrayin interfaceCollection<ITEM extends ICollectionValue>- Specified by:
toArrayin interfaceList<ITEM extends ICollectionValue>
-
containsAll
- Specified by:
containsAllin interfaceCollection<ITEM extends ICollectionValue>- Specified by:
containsAllin interfaceList<ITEM extends ICollectionValue>
-
get
- Specified by:
getin interfaceList<ITEM extends ICollectionValue>
-
indexOf
- Specified by:
indexOfin interfaceList<ITEM extends ICollectionValue>
-
lastIndexOf
- Specified by:
lastIndexOfin interfaceList<ITEM extends ICollectionValue>
-
listIterator
- Specified by:
listIteratorin interfaceList<ITEM extends ICollectionValue>
-
listIterator
- Specified by:
listIteratorin interfaceList<ITEM extends ICollectionValue>
-
subList
- Specified by:
subListin interfaceList<ITEM extends ICollectionValue>
-
toArrayItem
ACollectorimplementation to generates a sequence from a stream of Metapath items.- Type Parameters:
T- the Java type of the items- Returns:
- a collector that will generate a sequence
-
toSequence
Description copied from interface:ICollectionValueGet 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:
toSequencein interfaceICollectionValue- Specified by:
toSequencein interfaceIItem- Returns:
- the resulting sequence
-
flatten
Description copied from interface:ICollectionValueGet the stream of items for the collection value.If the collection value contains items, then these items are returned.
- Specified by:
flattenin interfaceICollectionValue- Specified by:
flattenin interfaceIItem- Returns:
- a stream of related items
-
ofCollection
Get a new, immutable array item that contains the items in the provided list.- Type Parameters:
T- the item Java type- Parameters:
items- the list whose items are to be added to the new array- Returns:
- an array item containing the specified entries
-
of
Returns an unmodifiable array item containing zero elements.- Type Parameters:
T- the item type- Returns:
- an empty
IArrayItem
-
of
Returns an unmodifiable array item containing one item.- Type Parameters:
T- theIArrayItem's item type- Parameters:
e1- the single item- Returns:
- an
IArrayItemcontaining the specified item - Throws:
NullPointerException- if the item isnull
-
of
Returns an unmodifiable array item containing two items.- Type Parameters:
T- theIArrayItem's item type- Parameters:
e1- the first iteme2- the second item- Returns:
- an
IArrayItemcontaining the specified items - Throws:
NullPointerException- if an item isnull
-
of
@NonNull static <T extends ICollectionValue> IArrayItem<T> of(@NonNull T e1, @NonNull T e2, @NonNull T e3) Returns an unmodifiable array item containing three elements.- Type Parameters:
T- theIArrayItem's item type- Parameters:
e1- the first iteme2- the second iteme3- the third item- Returns:
- an
IArrayItemcontaining the specified items - Throws:
NullPointerException- if an item isnull
-
of
@NonNull static <T extends ICollectionValue> IArrayItem<T> of(@NonNull T e1, @NonNull T e2, @NonNull T e3, @NonNull T e4) Returns an unmodifiable array item containing four items.- Type Parameters:
T- theIArrayItem's item type- Parameters:
e1- the first iteme2- the second iteme3- the third iteme4- the fourth item- Returns:
- an
IArrayItemcontaining the specified items - Throws:
NullPointerException- if an item isnull
-
of
@NonNull static <T extends ICollectionValue> IArrayItem<T> of(@NonNull T e1, @NonNull T e2, @NonNull T e3, @NonNull T e4, @NonNull T e5) Returns an unmodifiable array item containing five items.- Type Parameters:
T- theIArrayItem's item type- Parameters:
e1- the first iteme2- the second iteme3- the third iteme4- the fourth iteme5- the fifth item- Returns:
- an
IArrayItemcontaining the specified items - Throws:
NullPointerException- if an item isnull
-
of
@NonNull static <T extends ICollectionValue> IArrayItem<T> of(@NonNull T e1, @NonNull T e2, @NonNull T e3, @NonNull T e4, @NonNull T e5, @NonNull T e6) Returns an unmodifiable array item containing six items.- Type Parameters:
T- theIArrayItem's item type- Parameters:
e1- the first iteme2- the second iteme3- the third iteme4- the fourth iteme5- the fifth iteme6- the sixth item- Returns:
- an
IArrayItemcontaining the specified items - Throws:
NullPointerException- if an item isnull
-
of
@NonNull static <T extends ICollectionValue> IArrayItem<T> of(@NonNull T e1, @NonNull T e2, @NonNull T e3, @NonNull T e4, @NonNull T e5, @NonNull T e6, @NonNull T e7) Returns an unmodifiable array item containing seven items.- Type Parameters:
T- theIArrayItem's item type- Parameters:
e1- the first iteme2- the second iteme3- the third iteme4- the fourth iteme5- the fifth iteme6- the sixth iteme7- the seventh item- Returns:
- an
IArrayItemcontaining the specified items - Throws:
NullPointerException- if an item isnull
-
of
@NonNull static <T extends ICollectionValue> IArrayItem<T> of(@NonNull T e1, @NonNull T e2, @NonNull T e3, @NonNull T e4, @NonNull T e5, @NonNull T e6, @NonNull T e7, @NonNull T e8) Returns an unmodifiable array item containing eight items.- Type Parameters:
T- theIArrayItem's item type- Parameters:
e1- the first iteme2- the second iteme3- the third iteme4- the fourth iteme5- the fifth iteme6- the sixth iteme7- the seventh iteme8- the eighth item- Returns:
- an
IArrayItemcontaining the specified items - Throws:
NullPointerException- if an item isnull
-
of
@NonNull static <T extends ICollectionValue> IArrayItem<T> of(@NonNull T e1, @NonNull T e2, @NonNull T e3, @NonNull T e4, @NonNull T e5, @NonNull T e6, @NonNull T e7, @NonNull T e8, @NonNull T e9) Returns an unmodifiable array item containing nine items.- Type Parameters:
T- theIArrayItem's item type- Parameters:
e1- the first iteme2- the second iteme3- the third iteme4- the fourth iteme5- the fifth iteme6- the sixth iteme7- the seventh iteme8- the eighth iteme9- the ninth item- Returns:
- an
IArrayItemcontaining the specified items - Throws:
NullPointerException- if an item isnull
-
of
@NonNull static <T extends ICollectionValue> IArrayItem<T> of(@NonNull T e1, @NonNull T e2, @NonNull T e3, @NonNull T e4, @NonNull T e5, @NonNull T e6, @NonNull T e7, @NonNull T e8, @NonNull T e9, @NonNull T e10) Returns an unmodifiable array item containing ten items.- Type Parameters:
T- theIArrayItem's item type- Parameters:
e1- the first iteme2- the second iteme3- the third iteme4- the fourth iteme5- the fifth iteme6- the sixth iteme7- the seventh iteme8- the eighth iteme9- the ninth iteme10- the tenth item- Returns:
- an
IArrayItemcontaining the specified items - Throws:
NullPointerException- if an item isnull
-
of
Returns an unmodifiable array item containing an arbitrary number of items.- Type Parameters:
T- theIArrayItem's item type- Parameters:
items- the items to be contained in the list- Returns:
- an
IArrayItemcontaining the specified items - Throws:
NullPointerException- if an item isnullor if the array isnull
-
copyOf
@NonNull static <T extends ICollectionValue> IArrayItem<T> copyOf(@NonNull Collection<? extends T> collection) Returns an unmodifiable array item containing the items of the given Collection, in its iteration order. The given Collection must not be null, and it must not contain any null items. If the given Collection is subsequently modified, the returned array item will not reflect such modifications.- Type Parameters:
T- theIArrayItem's item type- Parameters:
collection- aCollectionfrom which items are drawn, must be non-null- Returns:
- an
IArrayItemcontaining the items of the givenCollection - Throws:
NullPointerException- if collection is null, or if it contains any nulls
-
accept
Description copied from interface:IItemA visitor callback used to visit a variety of Metapath item types.
-