Interface NamedProvider<T>
- Type Parameters:
T
- element-type
- All Known Subinterfaces:
NamedProviderStore<T>
- All Known Implementing Classes:
EagerEvaluationStore
,ExtractFrameStore
,LazyEvaluationStore
,NamedProviderBridge
,NamedProviderCombine
,NamedStacks
,NameValueMap
,SharedFeatures
public interface NamedProvider<T>
A collection of elements, each with an associated name.
- Author:
- Owen Feehan
-
Method Summary
Modifier and TypeMethodDescriptiondefault T
Gets one element of the provider (arbitrarily).default T
getException
(String identifier) Retrieves the item if it exists, or throws an exception if it doesn't exist.getOptional
(String identifier) Retrieves the item if it exists, or returnsOptional.empty()
if it doesn't exist.default boolean
isEmpty()
Are there any items in the provider?keys()
Returns a set of keys associated with the provider.
-
Method Details
-
keys
Returns a set of keys associated with the provider.There's no guarantee that it refers to all valid keys.
- Returns:
- a set of all keys associated with the provider.
-
getOptional
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).
- Parameters:
identifier
- a unique name for the item.- Returns:
- the item, if it exists, otherwise
Optional.empty()
. - Throws:
NamedProviderGetException
- if no item exists foridentifier
.
-
getException
Retrieves the item if it exists, or throws an exception if it doesn't exist.- Parameters:
identifier
- a unique name for the item.- Returns:
- the item
- Throws:
NamedProviderGetException
- if no item exists foridentifier
-
getArbitraryElement
Gets one element of the provider (arbitrarily).- Returns:
- one of the elements of the array (arbitrary which one).
- Throws:
OperationFailedException
- if the array has no elements.
-
isEmpty
default boolean isEmpty()Are there any items in the provider?- Returns:
- true iff at least one item exists.
-