T
- The base type of object in the registry.public interface MutableRegistry<T> extends Registry
Registry
that is also mutable.Modifier and Type | Method and Description |
---|---|
<O extends T> |
register(Class<O> type,
O object)
Register the given object under the given type.
|
void |
register(T object)
Registers the given object with its concrete type.
|
<O extends T> |
registerLazy(Class<O> type,
Factory<? extends O> factory)
Registers a lazily created entry to the registry.
|
<O extends T> |
remove(Class<O> type)
Remove the registration for the given type.
|
<O extends T> void register(Class<O> type, O object)
O
- The public type of the objecttype
- The public type of the objectobject
- The object to add to the registryvoid register(T object)
object
- The object to register<O extends T> void registerLazy(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.
O
- the public type of the registry entrytype
- the public type of the registry entryfactory
- the factory for creating the object when needed<O extends T> void remove(Class<O> type) throws NotInRegistryException
O
- The type of the thing to removetype
- The type of the thing to removeNotInRegistryException
- if there is nothing registered by that type