Interface Registry<T>

All Known Implementing Classes:
SimpleRegistry

public interface Registry<T>
A read-only collection of values addressed by TypedKey, such as the entity types.
Since:
0.1.0
  • Method Summary

    Modifier and Type
    Method
    Description
    find(TypedKey<T> key)
    Returns the value registered under a key, or empty if there is none.
    get(TypedKey<T> key)
    Gets the value registered under a key.
    key(T value)
    Gets the key a value is registered under.
    Returns the key identifying this registry.
    Returns a stream over every registered value, in registration order.
    Returns every registered value, in registration order.
  • Method Details

    • registryKey

      RegistryKey<T> registryKey()
      Returns the key identifying this registry.
      Returns:
      the key identifying this registry
      Since:
      0.1.0
    • get

      T get(TypedKey<T> key)
      Gets the value registered under a key.
      Parameters:
      key - the key
      Returns:
      the value
      Throws:
      NoSuchElementException - if nothing is registered under that key
      Since:
      0.1.0
    • find

      Optional<T> find(TypedKey<T> key)
      Returns the value registered under a key, or empty if there is none.
      Parameters:
      key - the key
      Returns:
      the value registered under a key, or empty if there is none
      Since:
      0.1.0
    • key

      TypedKey<T> key(T value)
      Gets the key a value is registered under.
      Parameters:
      value - the value
      Returns:
      its key
      Throws:
      UnsupportedOperationException - if this registry cannot map values back to keys
      Since:
      0.1.0
    • values

      Collection<T> values()
      Returns every registered value, in registration order.
      Returns:
      every registered value, in registration order
      Since:
      0.1.0
    • stream

      Stream<T> stream()
      Returns a stream over every registered value, in registration order.
      Returns:
      a stream over every registered value, in registration order
      Since:
      0.1.0