Class SimpleRegistry<T>
java.lang.Object
fr.fidorial.registry.SimpleRegistry<T>
- All Implemented Interfaces:
Registry<T>
An immutable
Registry built once from a list of keys. It does not support key(Object).- Since:
- 0.1.0
-
Method Summary
Modifier and TypeMethodDescriptionReturns the value registered under a key, or empty if there is none.Gets the value registered under a key.Gets the key a value is registered under.static <T> SimpleRegistry<T> of(RegistryKey<T> registryKey, Collection<TypedKey<T>> keys, Function<Key, T> resolver) Builds a registry by resolving every key.Returns the key identifying this registry.stream()Returns a stream over every registered value, in registration order.values()Returns every registered value, in registration order.
-
Method Details
-
of
public static <T> SimpleRegistry<T> of(RegistryKey<T> registryKey, Collection<TypedKey<T>> keys, Function<Key, T> resolver) Builds a registry by resolving every key.- Type Parameters:
T- the value type- Parameters:
registryKey- the key identifying the registrykeys- the keys to register, in orderresolver- resolves the value of each key- Returns:
- the registry
- Since:
- 0.1.0
-
registryKey
Description copied from interface:RegistryReturns the key identifying this registry.- Specified by:
registryKeyin interfaceRegistry<T>- Returns:
- the key identifying this registry
-
get
-
find
-
key
-
values
-
stream
-