Class NamedProviderCombine<T>
Object
NamedProviderCombine<T>
- Type Parameters:
T- element-type
- All Implemented Interfaces:
NamedProvider<T>
Combines one more
NamedProviders into a unitary NamedProvider.
Queries are applied sequentially to each NamedProvider until successful.
All keys from all underlying NamedProviders 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 ofNamedProviders. -
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, waitMethods inherited from interface org.anchoranalysis.core.identifier.provider.NamedProvider
getArbitraryElement, getException, isEmpty
-
Constructor Details
-
NamedProviderCombine
Create from a stream ofNamedProviders.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:NamedProviderRetrieves 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:
getOptionalin 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:NamedProviderReturns a set of keys associated with the provider.There's no guarantee that it refers to all valid keys.
- Specified by:
keysin interfaceNamedProvider<T>- Returns:
- a set of all keys associated with the provider.
-