Interface ParameterizedBuilderRegistry
- All Superinterfaces:
AutoCloseable
,Disposable
,Iterable<ParameterizedBuilderRegistry.Registration>
- All Known Implementing Classes:
SimpleParameterizedBuilderRegistry
public interface ParameterizedBuilderRegistry
extends Disposable, Iterable<ParameterizedBuilderRegistry.Registration>
A registry of strongly typed and possibly named
ParameterizedBuilder
s.
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.
- Since:
- Coherence 12.1.3
- Author:
- bo 2014.10.27
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Defines a singleParameterizedBuilder
registration with aParameterizedBuilderRegistry
. -
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The name to use for the registration of a singleton and thus default resource. -
Method Summary
Modifier and TypeMethodDescription<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 aParameterizedBuilder
for later retrieval withgetBuilder(Class)
.<T> String
registerBuilder
(Class<T> clzInstance, String sBuilderName, ParameterizedBuilder<? extends T> builder) Registers aParameterizedBuilder
with the specified name for later retrieval withgetBuilder(Class, String)
.Methods inherited from interface com.oracle.coherence.common.base.Disposable
close, dispose
Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
-
Field Details
-
DEFAULT_NAME
The name to use for the registration of a singleton and thus default resource.- See Also:
-
-
Method Details
-
getBuilder
Attempts to retrieve the builder that was registered with the specified class.- Type Parameters:
T
- the type of the instance that will be produced by the builder- Parameters:
clzInstance
- the class of the instance- Returns:
- the registered builder or
null
if the builder is unknown to theParameterizedBuilderRegistry
-
getBuilder
Attempts to retrieve the builder that was registered with the specified class and name.- Type Parameters:
T
- the type of the instance that will be produced by the builder- Parameters:
clzInstance
- the class of the instancesBuilderName
- the name of the builder- Returns:
- the registered builder or
null
if the builder is unknown to theParameterizedBuilderRegistry
-
registerBuilder
<T> String registerBuilder(Class<T> clzInstance, ParameterizedBuilder<? extends T> builder) throws IllegalArgumentException Registers aParameterizedBuilder
for later retrieval withgetBuilder(Class)
.Notes:
- Multiple builders for the same class can be registered if each
builder is registered with a unique name via
registerBuilder(Class, String, ParameterizedBuilder)
- Registration of builders will occur in a thread-safe manner.
- Builders that are
Disposable
will be disposed when theParameterizedBuilderRegistry
is disposed.
- Parameters:
clzInstance
- the class of instances produced by the builderbuilder
- the builder- Returns:
- the actual name used to register the builder
- Throws:
IllegalArgumentException
- if a builder of the same specified type is already registered
- Multiple builders for the same class can be registered if each
builder is registered with a unique name via
-
registerBuilder
<T> String registerBuilder(Class<T> clzInstance, String sBuilderName, ParameterizedBuilder<? extends T> builder) throws IllegalArgumentException Registers aParameterizedBuilder
with the specified name for later retrieval withgetBuilder(Class, String)
.Notes:
- Registration of builders will occur in a thread-safe manner.
- Builders that are
Disposable
will be disposed when theParameterizedBuilderRegistry
is disposed.
- Parameters:
clzInstance
- the class of instances produced by the buildersBuilderName
- the proposed name of the builderbuilder
- the builder- Returns:
- the actual name used to register the builder
- Throws:
IllegalArgumentException
- if a builder of the same specified type and name is already registered
-