Module dev.metaschema.core
Interface IMapItem<VALUE extends ICollectionValue>
- Type Parameters:
VALUE- the value type
- All Superinterfaces:
ICollectionValue,IFunction,IItem,Map<IMapKey,VALUE>
Represents a mapping of
IMapKey keys to values.-
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 ISequence<?>Get the collection value as a sequence.static <K extends IAnyAtomicItem,V extends ICollectionValue>
IMapItem<V>Returns an unmodifiable Map item containing the entries of the given Map.static <V extends ICollectionValue>
IMapItem<V>empty()Get an empty, immutable map item.static <V extends ICollectionValue>
Map.Entry<IMapKey,V> entry(IAnyAtomicItem key, V value) Returns an unmodifiableMap.Entrycontaining the given key and value.static <V extends ICollectionValue>
Map.Entry<IMapKey,V> Returns an unmodifiableMap.Entrycontaining the given key and value.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 booleanisEmpty()Determine if this sequence is empty.static <V extends ICollectionValue>
IMapItem<V>of()Returns an unmodifiable map item containing zero mappings.static <K extends IAnyAtomicItem,V extends ICollectionValue>
IMapItem<V>of(K k1, V v1) Returns an unmodifiable map item containing a single mapping.static <K extends IAnyAtomicItem,V extends ICollectionValue>
IMapItem<V>of(K k1, V v1, K k2, V v2) Returns an unmodifiable map item containing two mappings.static <K extends IAnyAtomicItem,V extends ICollectionValue>
IMapItem<V>of(K k1, V v1, K k2, V v2, K k3, V v3) Returns an unmodifiable map item containing three mappings.static <K extends IAnyAtomicItem,V extends ICollectionValue>
IMapItem<V>of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4) Returns an unmodifiable map item containing four mappings.static <K extends IAnyAtomicItem,V extends ICollectionValue>
IMapItem<V>of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5) Returns an unmodifiable map item containing five mappings.static <K extends IAnyAtomicItem,V extends ICollectionValue>
IMapItem<V>of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6) Returns an unmodifiable map item containing six mappings.static <K extends IAnyAtomicItem,V extends ICollectionValue>
IMapItem<V>of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7) Returns an unmodifiable map item containing seven mappings.static <K extends IAnyAtomicItem,V extends ICollectionValue>
IMapItem<V>of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8) Returns an unmodifiable map item containing eight mappings.static <K extends IAnyAtomicItem,V extends ICollectionValue>
IMapItem<V>of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9) Returns an unmodifiable map item containing nine mappings.static <K extends IAnyAtomicItem,V extends ICollectionValue>
IMapItem<V>of(K k1, V v1, K k2, V v2, K k3, V v3, K k4, V v4, K k5, V v5, K k6, V v6, K k7, V v7, K k8, V v8, K k9, V v9, K k10, V v10) Returns an unmodifiable map item containing ten mappings.static <V extends ICollectionValue>
IMapItem<V>ofCollection(Map<IMapKey, V> map) Get a new, immutable map item that contains the items in the provided map.static <K extends IAnyAtomicItem,V extends ICollectionValue>
IMapItem<V>Returns an unmodifiable map item containing keys and values extracted from the given entries.default intsize()Get the count of items in this sequence.static <T extends ICollectionValue>
Collector<Map.Entry<IMapKey,T>, ?, IMapItem<T>> ACollectorimplementation to generates a sequence from a stream of Metapath items.Get the collection value as a sequence.static IItemTypetype()Get the type information for this item.Methods inherited from interface dev.metaschema.core.metapath.function.IFunction
arity, deepEquals, execute, getArguments, getName, getProperties, getQName, getResult, isArityUnbounded, isContextDepenent, isDeterministic, isFocusDependent, isNamedFunction, toAtomicItem, toSignatureMethods inherited from interface java.util.Map
clear, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, equals, forEach, get, getOrDefault, hashCode, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, values
-
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 map item.- Type Parameters:
V- the value 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
-
isEmpty
default boolean isEmpty()Determine if this sequence is empty.- Specified by:
isEmptyin interfaceMap<IMapKey,VALUE 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 interfaceMap<IMapKey,VALUE extends ICollectionValue> - Returns:
- the count of items
-
toMapItem
@NonNull static <T extends ICollectionValue> Collector<Map.Entry<IMapKey,T>, toMapItem()?, IMapItem<T>> 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
-
ofCollection
Get a new, immutable map item that contains the items in the provided map.- Type Parameters:
V- the value Java type- Parameters:
map- the map whose items are to be added to the new map- Returns:
- a map item containing the specified entries
-
of
Returns an unmodifiable map item containing zero mappings.- Type Parameters:
V- the value Java type- Returns:
- an empty
IMapItem
-
of
@NonNull static <K extends IAnyAtomicItem,V extends ICollectionValue> IMapItem<V> of(@NonNull K k1, @NonNull V v1) Returns an unmodifiable map item containing a single mapping.- Type Parameters:
K- the map item's key typeV- the map item's value type- Parameters:
k1- the mapping's keyv1- the mapping's value- Returns:
- a map item containing the specified mapping
- Throws:
NullPointerException- if the key or the value isnull
-
of
@NonNull static <K extends IAnyAtomicItem,V extends ICollectionValue> IMapItem<V> of(@NonNull K k1, @NonNull V v1, @NonNull K k2, @NonNull V v2) Returns an unmodifiable map item containing two mappings.- Type Parameters:
K- the map item's key typeV- the map item's value type- Parameters:
k1- the first mapping's keyv1- the first mapping's valuek2- the second mapping's keyv2- the second mapping's value- Returns:
- a map item containing the specified mappings
- Throws:
IllegalArgumentException- if the keys are duplicatesNullPointerException- if any key or value isnull
-
of
@NonNull static <K extends IAnyAtomicItem,V extends ICollectionValue> IMapItem<V> of(@NonNull K k1, @NonNull V v1, @NonNull K k2, @NonNull V v2, @NonNull K k3, @NonNull V v3) Returns an unmodifiable map item containing three mappings.- Type Parameters:
K- the map item's key typeV- the map item's value type- Parameters:
k1- the first mapping's keyv1- the first mapping's valuek2- the second mapping's keyv2- the second mapping's valuek3- the third mapping's keyv3- the third mapping's value- Returns:
- a map item containing the specified mappings
- Throws:
IllegalArgumentException- if there are any duplicate keysNullPointerException- if any key or value isnull
-
of
@NonNull static <K extends IAnyAtomicItem,V extends ICollectionValue> IMapItem<V> of(@NonNull K k1, @NonNull V v1, @NonNull K k2, @NonNull V v2, @NonNull K k3, @NonNull V v3, @NonNull K k4, @NonNull V v4) Returns an unmodifiable map item containing four mappings.- Type Parameters:
K- the map item's key typeV- the map item's value type- Parameters:
k1- the first mapping's keyv1- the first mapping's valuek2- the second mapping's keyv2- the second mapping's valuek3- the third mapping's keyv3- the third mapping's valuek4- the fourth mapping's keyv4- the fourth mapping's value- Returns:
- a map item containing the specified mappings
- Throws:
IllegalArgumentException- if there are any duplicate keysNullPointerException- if any key or value isnull
-
of
@NonNull static <K extends IAnyAtomicItem,V extends ICollectionValue> IMapItem<V> of(@NonNull K k1, @NonNull V v1, @NonNull K k2, @NonNull V v2, @NonNull K k3, @NonNull V v3, @NonNull K k4, @NonNull V v4, @NonNull K k5, @NonNull V v5) Returns an unmodifiable map item containing five mappings.- Type Parameters:
K- the map item's key typeV- the map item's value type- Parameters:
k1- the first mapping's keyv1- the first mapping's valuek2- the second mapping's keyv2- the second mapping's valuek3- the third mapping's keyv3- the third mapping's valuek4- the fourth mapping's keyv4- the fourth mapping's valuek5- the fifth mapping's keyv5- the fifth mapping's value- Returns:
- a map item containing the specified mappings
- Throws:
IllegalArgumentException- if there are any duplicate keysNullPointerException- if any key or value isnull
-
of
@NonNull static <K extends IAnyAtomicItem,V extends ICollectionValue> IMapItem<V> of(@NonNull K k1, @NonNull V v1, @NonNull K k2, @NonNull V v2, @NonNull K k3, @NonNull V v3, @NonNull K k4, @NonNull V v4, @NonNull K k5, @NonNull V v5, @NonNull K k6, @NonNull V v6) Returns an unmodifiable map item containing six mappings.- Type Parameters:
K- the map item's key typeV- the map item's value type- Parameters:
k1- the first mapping's keyv1- the first mapping's valuek2- the second mapping's keyv2- the second mapping's valuek3- the third mapping's keyv3- the third mapping's valuek4- the fourth mapping's keyv4- the fourth mapping's valuek5- the fifth mapping's keyv5- the fifth mapping's valuek6- the sixth mapping's keyv6- the sixth mapping's value- Returns:
- a map item containing the specified mappings
- Throws:
IllegalArgumentException- if there are any duplicate keysNullPointerException- if any key or value isnull
-
of
@NonNull static <K extends IAnyAtomicItem,V extends ICollectionValue> IMapItem<V> of(@NonNull K k1, @NonNull V v1, @NonNull K k2, @NonNull V v2, @NonNull K k3, @NonNull V v3, @NonNull K k4, @NonNull V v4, @NonNull K k5, @NonNull V v5, @NonNull K k6, @NonNull V v6, @NonNull K k7, @NonNull V v7) Returns an unmodifiable map item containing seven mappings.- Type Parameters:
K- the map item's key typeV- the map item's value type- Parameters:
k1- the first mapping's keyv1- the first mapping's valuek2- the second mapping's keyv2- the second mapping's valuek3- the third mapping's keyv3- the third mapping's valuek4- the fourth mapping's keyv4- the fourth mapping's valuek5- the fifth mapping's keyv5- the fifth mapping's valuek6- the sixth mapping's keyv6- the sixth mapping's valuek7- the seventh mapping's keyv7- the seventh mapping's value- Returns:
- a map item containing the specified mappings
- Throws:
IllegalArgumentException- if there are any duplicate keysNullPointerException- if any key or value isnull
-
of
@NonNull static <K extends IAnyAtomicItem,V extends ICollectionValue> IMapItem<V> of(@NonNull K k1, @NonNull V v1, @NonNull K k2, @NonNull V v2, @NonNull K k3, @NonNull V v3, @NonNull K k4, @NonNull V v4, @NonNull K k5, @NonNull V v5, @NonNull K k6, @NonNull V v6, @NonNull K k7, @NonNull V v7, @NonNull K k8, @NonNull V v8) Returns an unmodifiable map item containing eight mappings. See Unmodifiable Maps for details.- Type Parameters:
K- the map item's key typeV- the map item's value type- Parameters:
k1- the first mapping's keyv1- the first mapping's valuek2- the second mapping's keyv2- the second mapping's valuek3- the third mapping's keyv3- the third mapping's valuek4- the fourth mapping's keyv4- the fourth mapping's valuek5- the fifth mapping's keyv5- the fifth mapping's valuek6- the sixth mapping's keyv6- the sixth mapping's valuek7- the seventh mapping's keyv7- the seventh mapping's valuek8- the eighth mapping's keyv8- the eighth mapping's value- Returns:
- a map item containing the specified mappings
- Throws:
IllegalArgumentException- if there are any duplicate keysNullPointerException- if any key or value isnull
-
of
@NonNull static <K extends IAnyAtomicItem,V extends ICollectionValue> IMapItem<V> of(@NonNull K k1, @NonNull V v1, @NonNull K k2, @NonNull V v2, @NonNull K k3, @NonNull V v3, @NonNull K k4, @NonNull V v4, @NonNull K k5, @NonNull V v5, @NonNull K k6, @NonNull V v6, @NonNull K k7, @NonNull V v7, @NonNull K k8, @NonNull V v8, @NonNull K k9, @NonNull V v9) Returns an unmodifiable map item containing nine mappings.- Type Parameters:
K- the map item's key typeV- the map item's value type- Parameters:
k1- the first mapping's keyv1- the first mapping's valuek2- the second mapping's keyv2- the second mapping's valuek3- the third mapping's keyv3- the third mapping's valuek4- the fourth mapping's keyv4- the fourth mapping's valuek5- the fifth mapping's keyv5- the fifth mapping's valuek6- the sixth mapping's keyv6- the sixth mapping's valuek7- the seventh mapping's keyv7- the seventh mapping's valuek8- the eighth mapping's keyv8- the eighth mapping's valuek9- the ninth mapping's keyv9- the ninth mapping's value- Returns:
- a map item containing the specified mappings
- Throws:
IllegalArgumentException- if there are any duplicate keysNullPointerException- if any key or value isnull
-
of
@NonNull static <K extends IAnyAtomicItem,V extends ICollectionValue> IMapItem<V> of(@NonNull K k1, @NonNull V v1, @NonNull K k2, @NonNull V v2, @NonNull K k3, @NonNull V v3, @NonNull K k4, @NonNull V v4, @NonNull K k5, @NonNull V v5, @NonNull K k6, @NonNull V v6, @NonNull K k7, @NonNull V v7, @NonNull K k8, @NonNull V v8, @NonNull K k9, @NonNull V v9, @NonNull K k10, @NonNull V v10) Returns an unmodifiable map item containing ten mappings.- Type Parameters:
K- the map item's key typeV- the map item's value type- Parameters:
k1- the first mapping's keyv1- the first mapping's valuek2- the second mapping's keyv2- the second mapping's valuek3- the third mapping's keyv3- the third mapping's valuek4- the fourth mapping's keyv4- the fourth mapping's valuek5- the fifth mapping's keyv5- the fifth mapping's valuek6- the sixth mapping's keyv6- the sixth mapping's valuek7- the seventh mapping's keyv7- the seventh mapping's valuek8- the eighth mapping's keyv8- the eighth mapping's valuek9- the ninth mapping's keyv9- the ninth mapping's valuek10- the tenth mapping's keyv10- the tenth mapping's value- Returns:
- a map item containing the specified mappings
- Throws:
IllegalArgumentException- if there are any duplicate keysNullPointerException- if any key or value isnull
-
ofEntries
@SafeVarargs @NonNull static <K extends IAnyAtomicItem,V extends ICollectionValue> IMapItem<V> ofEntries(Map.Entry<IMapKey, ? extends V>... entries) Returns an unmodifiable map item containing keys and values extracted from the given entries. The entries themselves are not stored in the map.- Type Parameters:
K- the map item's key typeV- the map item's value type- Parameters:
entries-Map.Entrys containing the keys and values from which the map is populated- Returns:
- a map item containing the specified mappings
- Throws:
IllegalArgumentException- if there are any duplicate keysNullPointerException- if any entry, key, or value isnull, or if theentriesarray isnull
-
entry
@NonNull static <V extends ICollectionValue> Map.Entry<IMapKey,V> entry(@NonNull IAnyAtomicItem key, @NonNull V value) Returns an unmodifiableMap.Entrycontaining the given key and value.- Type Parameters:
V- the value's type- Parameters:
key- the keyvalue- the value- Returns:
- an
Map.Entrycontaining the specified key and value - Throws:
NullPointerException- if the key or value isnull
-
entry
@NonNull static <V extends ICollectionValue> Map.Entry<IMapKey,V> entry(@NonNull IMapKey key, @NonNull V value) Returns an unmodifiableMap.Entrycontaining the given key and value.- Type Parameters:
V- the value's type- Parameters:
key- the keyvalue- the value- Returns:
- an
Map.Entrycontaining the specified key and value - Throws:
NullPointerException- if the key or value isnull
-
copyOf
@NonNull static <K extends IAnyAtomicItem,V extends ICollectionValue> IMapItem<V> copyOf(Map<? extends IMapKey, ? extends V> map) Returns an unmodifiable Map item containing the entries of the given Map. The given Map must not be null, and it must not contain any null keys or values. If the given Map is subsequently modified, the returned Map will not reflect such modifications.- Type Parameters:
K- the map item's key typeV- the map item's value type- Parameters:
map- a map item from which entries are drawn, must be non-null- Returns:
- a map item containing the entries of the given
Map - Throws:
NullPointerException- if map is null, or if it contains any null keys or values
-
accept
Description copied from interface:IItemA visitor callback used to visit a variety of Metapath item types.
-