Class NamedProviderCombine<T>
Object
NamedProviderCombine<T>
- Type Parameters:
T
- element-type
- All Implemented Interfaces:
NamedProvider<T>
Combines one more
NamedProvider
s into a unitary NamedProvider
.
Queries are applied sequentially to each NamedProvider
until successful.
All keys from all underlying NamedProvider
s are valid, but maximally one entry will be
returned for a corresponding key, as first encountered during iteration.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionNamedProviderCombine
(Stream<NamedProvider<T>> stream) Create from a stream ofNamedProvider
s. -
Method Summary
Modifier and TypeMethodDescriptiongetOptional
(String key) Retrieves the item if it exists, or returnsOptional.empty()
if it doesn't exist.keys()
Returns a set of keys associated with the provider.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.anchoranalysis.core.identifier.provider.NamedProvider
getArbitraryElement, getException, isEmpty
-
Constructor Details
-
NamedProviderCombine
Create from a stream ofNamedProvider
s.Note that the order of this stream, determines the order in which queries occur.
- Parameters:
stream
- the stream
-
-
Method Details
-
getOptional
Description copied from interface:NamedProvider
Retrieves the item if it exists, or returnsOptional.empty()
if it doesn't exist.Note that a 'key' might still throw an exception for another reason (but never because a particular key is absent).
- Specified by:
getOptional
in interfaceNamedProvider<T>
- Parameters:
key
- a unique name for the item.- Returns:
- the item, if it exists, otherwise
Optional.empty()
. - Throws:
NamedProviderGetException
- if no item exists foridentifier
.
-
keys
Description copied from interface:NamedProvider
Returns a set of keys associated with the provider.There's no guarantee that it refers to all valid keys.
- Specified by:
keys
in interfaceNamedProvider<T>
- Returns:
- a set of all keys associated with the provider.
-