public interface ParameterizedBuilderRegistry extends Disposable, Iterable<ParameterizedBuilderRegistry.Registration>
ParameterizedBuilders.
When a ParameterizedBuilder is registered with a ParameterizedBuilderRegistry, the
ParameterizedBuilderRegistry assumes ownership of the said builder, up until
at which point the ParameterizedBuilderRegistry is disposed.
Important: Although a ParameterizedBuilderRegistry manages
builders in a thread-safe manner, it is possible for a thread calling
getBuilder(Class, String) to receive a null return
value while another thread is registering a builder.
| Modifier and Type | Interface and Description |
|---|---|
static interface |
ParameterizedBuilderRegistry.Registration<T>
Defines a single
ParameterizedBuilder registration with a
ParameterizedBuilderRegistry. |
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_NAME
The name to use for the registration of a singleton and thus default resource.
|
| Modifier and Type | Method and Description |
|---|---|
<T> ParameterizedBuilder<T> |
getBuilder(Class<T> clzInstance)
Attempts to retrieve the builder that was registered with the
specified class.
|
<T> ParameterizedBuilder<T> |
getBuilder(Class<T> clzInstance,
String sBuilderName)
Attempts to retrieve the builder that was registered with the
specified class and name.
|
<T> String |
registerBuilder(Class<T> clzInstance,
ParameterizedBuilder<? extends T> builder)
Registers a
ParameterizedBuilder for later retrieval with getBuilder(Class). |
<T> String |
registerBuilder(Class<T> clzInstance,
String sBuilderName,
ParameterizedBuilder<? extends T> builder)
Registers a
ParameterizedBuilder with the specified name for later retrieval with
getBuilder(Class, String). |
close, disposeforEach, iterator, spliteratorstatic final String DEFAULT_NAME
<T> ParameterizedBuilder<T> getBuilder(Class<T> clzInstance)
T - the type of the instance that will be produced by the builderclzInstance - the class of the instancenull if the builder is
unknown to the ParameterizedBuilderRegistry<T> ParameterizedBuilder<T> getBuilder(Class<T> clzInstance, String sBuilderName)
T - the type of the instance that will be produced by the builderclzInstance - the class of the instancesBuilderName - the name of the buildernull if the builder is
unknown to the ParameterizedBuilderRegistry<T> String registerBuilder(Class<T> clzInstance, ParameterizedBuilder<? extends T> builder) throws IllegalArgumentException
ParameterizedBuilder for later retrieval with getBuilder(Class).
Notes:
registerBuilder(Class, String, ParameterizedBuilder)
Disposable will be disposed when the
ParameterizedBuilderRegistry is disposed.
clzInstance - the class of instances produced by the builderbuilder - the builderIllegalArgumentException - if a builder of the same specified type
is already registered<T> String registerBuilder(Class<T> clzInstance, String sBuilderName, ParameterizedBuilder<? extends T> builder) throws IllegalArgumentException
ParameterizedBuilder with the specified name for later retrieval with
getBuilder(Class, String).
Notes:
Disposable will be disposed when the
ParameterizedBuilderRegistry is disposed.
clzInstance - the class of instances produced by the builderbuilder - the buildersBuilderName - the proposed name of the builderIllegalArgumentException - if a builder of the same specified type
and name is already registered