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 Type
    Method
    Description
    default 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 returns Optional.empty() if it doesn't exist.
    default boolean
    Are there any items in the provider?
    Returns a set of keys associated with the provider.
  • Method Details

    • keys

      Set<String> 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

      Optional<T> getOptional(String identifier) throws NamedProviderGetException
      Retrieves the item if it exists, or returns 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).

      Parameters:
      identifier - a unique name for the item.
      Returns:
      the item, if it exists, otherwise Optional.empty().
      Throws:
      NamedProviderGetException - if no item exists for identifier.
    • getException

      default T getException(String identifier) throws NamedProviderGetException
      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 for identifier
    • getArbitraryElement

      default T getArbitraryElement() throws OperationFailedException
      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.