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 namedParameterizedBuilders.When a
ParameterizedBuilderis registered with aParameterizedBuilderRegistry, theParameterizedBuilderRegistryassumes ownership of the said builder, up until at which point theParameterizedBuilderRegistryisdisposed.Important: Although a
ParameterizedBuilderRegistrymanages builders in a thread-safe manner, it is possible for a thread callinggetBuilder(Class, String)to receive anullreturn value while another thread is registering a builder.- Since:
- Coherence 12.1.3
- Author:
- bo 2014.10.27
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceParameterizedBuilderRegistry.Registration<T>Defines a singleParameterizedBuilderregistration with aParameterizedBuilderRegistry.
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_NAMEThe name to use for the registration of a singleton and thus default resource.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method 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> StringregisterBuilder(Class<T> clzInstance, ParameterizedBuilder<? extends T> builder)Registers aParameterizedBuilderfor later retrieval withgetBuilder(Class).<T> StringregisterBuilder(Class<T> clzInstance, String sBuilderName, ParameterizedBuilder<? extends T> builder)Registers aParameterizedBuilderwith 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 Detail
-
DEFAULT_NAME
static final String DEFAULT_NAME
The name to use for the registration of a singleton and thus default resource.- See Also:
- Constant Field Values
-
-
Method Detail
-
getBuilder
<T> ParameterizedBuilder<T> getBuilder(Class<T> clzInstance)
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
nullif the builder is unknown to theParameterizedBuilderRegistry
-
getBuilder
<T> ParameterizedBuilder<T> getBuilder(Class<T> clzInstance, String sBuilderName)
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
nullif the builder is unknown to theParameterizedBuilderRegistry
-
registerBuilder
<T> String registerBuilder(Class<T> clzInstance, ParameterizedBuilder<? extends T> builder) throws IllegalArgumentException
Registers aParameterizedBuilderfor 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
Disposablewill be disposed when theParameterizedBuilderRegistryis 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 aParameterizedBuilderwith the specified name for later retrieval withgetBuilder(Class, String).Notes:
- Registration of builders will occur in a thread-safe manner.
- Builders that are
Disposablewill be disposed when theParameterizedBuilderRegistryis disposed.
- Parameters:
clzInstance- the class of instances produced by the builderbuilder- the buildersBuilderName- the proposed name of 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
-
-