public interface RegistryBuilder extends RegistrySpec
registries.
For create single entry registries, see the factory methods on Registries.
A builder can be used for creating an registry with multiple entries.
Registries.registry()| Modifier and Type | Method and Description |
|---|---|
<O> RegistryBuilder |
add(Class<? super O> type,
O object)
Adds a registry entry that is available by the given type.
|
<O> RegistryBuilder |
add(Class<O> type,
Factory<? extends O> factory)
Adds a lazily created entry to the registry.
|
RegistryBuilder |
add(Object object)
Adds a registry entry.
|
Registry |
build()
Builds the registry.
|
Registry |
build(Registry parent)
Builds a registry containing the entries specified by this builder and the given “parent” registry.
|
int |
size()
How many entries have been added so far.
|
int size()
<O> RegistryBuilder add(Class<? super O> type, O object)
add in interface RegistrySpecO - the public type of the registry entrytype - the public type of the registry entryobject - the actual registry entryRegistryBuilder add(Object object)
add in interface RegistrySpecobject - the object to add to the registry<O> RegistryBuilder add(Class<O> type, Factory<? extends O> factory)
The factory will be invoked exactly once, when a query is made to the registry of a compatible type of the given type.
add in interface RegistrySpecO - the public type of the registry entrytype - the public type of the registry entryfactory - the factory for creating the object when neededRegistry build()
Registry build(Registry parent)
This method uses Registries.join(Registry, Registry), with this registry as the child argument.
parent - the parent of the registry to createRegistries.join(Registry, Registry)