T
- element-typepublic interface NamedProvider<T>
Modifier and Type | Method and Description |
---|---|
default T |
getArbitraryElement()
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.
|
Optional<T> |
getOptional(String identifier)
Retrieves the item if it exists, or returns
Optional.empty() if it doesn't exist. |
default boolean |
isEmpty()
Are there any items in the provider?
|
Set<String> |
keys()
Returns a set of keys associated with the provider.
|
Set<String> keys()
There's no guarantee that it refers to all valid keys.
Optional<T> getOptional(String identifier) throws NamedProviderGetException
Optional.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).
identifier
- a unique name for the item.Optional.empty()
.NamedProviderGetException
- if no item exists for identifier
.default T getException(String identifier) throws NamedProviderGetException
identifier
- a unique name for the item.NamedProviderGetException
- if no item exists for identifier
default T getArbitraryElement() throws OperationFailedException
OperationFailedException
- if the array has no elements.default boolean isEmpty()
Copyright © 2010–2023 Owen Feehan, ETH Zurich, University of Zurich, Hoffmann-La Roche. All rights reserved.