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
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.
- Since:
- Coherence 12.1.3
- Author:
- bo 2014.10.27
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceDefines a singleParameterizedBuilderregistration with aParameterizedBuilderRegistry. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe 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> 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, disposeMethods 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
nullif 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
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
-