Class ClassScheme
- All Implemented Interfaces:
BackingMapManagerBuilder
,BuilderCustomization<Object>
,MapBuilder
,NamedCacheBuilder
,ParameterizedBuilder<Object>
,ParameterizedBuilder.ReflectionSupport
,ServiceBuilder
,CachingScheme
,ObservableCachingScheme
,Scheme
,ServiceScheme
public class ClassScheme
extends AbstractLocalCachingScheme<Object>
implements ParameterizedBuilder<Object>, ParameterizedBuilder.ReflectionSupport
The
ClassScheme
class is responsible for building custom CachingScheme
s and
custom CacheStoreScheme
s.
Note: The ParameterizedBuilder
interface is needed by both
CacheStoreScheme
and ElementProcessorHelper
.
This class will automatically inject the following types and named values into realized classes that have been annotated with @Injectable.
-
BackingMapManagerContext
(optionally named "manager-context") -
ConfigurableCacheFactory
- Cache Name (as a
String
.class named "cache-name") - Context
ClassLoader
(optionally named "class-loader") -
ResourceRegistry
-
CacheConfig
- together with any other resource, named or otherwise, available
in the
ResourceRegistry
provided by theConfigurableCacheFactory
.
- Since:
- Coherence 12.1.2
- Author:
- pfm 2012.02.27
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.tangosol.coherence.config.builder.MapBuilder
MapBuilder.Dependencies
Nested classes/interfaces inherited from interface com.tangosol.coherence.config.builder.ParameterizedBuilder
ParameterizedBuilder.ReflectionSupport
-
Field Summary
Fields inherited from class com.tangosol.coherence.config.scheme.AbstractServiceScheme
m_serviceDependencies
Fields inherited from interface com.tangosol.coherence.config.scheme.ServiceScheme
DELIM_APPLICATION_SCOPE, DELIM_DOMAIN_PARTITION
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturn the service type.boolean
Return true if a running cluster is needed before using a service.realize
(ParameterResolver resolver, ClassLoader loader, ParameterList listParameters) Realizes (creates if necessary) an instance of a object of type T, using the providedParameterResolver
to resolve values any referencedParameter
s.realizeCache
(ParameterResolver resolver, MapBuilder.Dependencies dependencies) Realizes aNamedCache
(possibly "ensuring it") based on the state of the builder, the providedParameterResolver
andMapBuilder
dependencies.realizeMap
(ParameterResolver resolver, MapBuilder.Dependencies dependencies) Realize aMap
based on the state of theMapBuilder
, resolvable parameters and providedMapBuilder.Dependencies
.boolean
realizes
(Class<?> clzClass, ParameterResolver resolver, ClassLoader loader) Determines if theParameterizedBuilder
will realize an instance of the specified class (without requiring the builder to actually realize an object).protected void
validate()
Validate the ClassScheme properties.Methods inherited from class com.tangosol.coherence.config.scheme.AbstractLocalCachingScheme
getCustomBuilder, setCustomBuilder
Methods inherited from class com.tangosol.coherence.config.scheme.AbstractCachingScheme
establishMapListeners, getDefaultParameterResolver, getListenerBuilder, realizeBackingMapManager, setListenerBuilder, validate
Methods inherited from class com.tangosol.coherence.config.scheme.AbstractServiceScheme
ensureService, getDefaultServiceName, getScopedServiceName, getScopeName, getServiceBuilder, getServiceDependencies, getServiceName, getXml, injectScopeNameIntoService, isAutoStart, realizeService, setAutoStart, setScopeName, setServiceDependencies, setServiceName, setXml
Methods inherited from class com.tangosol.coherence.config.scheme.AbstractScheme
getSchemeName, isAnonymous, setSchemeName
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.tangosol.coherence.config.scheme.Scheme
getSchemeName, isAnonymous
Methods inherited from interface com.tangosol.coherence.config.scheme.ServiceScheme
getScopedServiceName, getServiceBuilder, getServiceName, isAutoStart
-
Constructor Details
-
ClassScheme
public ClassScheme()
-
-
Method Details
-
getServiceType
Return the service type.- Specified by:
getServiceType
in interfaceServiceScheme
- Overrides:
getServiceType
in classAbstractLocalCachingScheme<Object>
- Returns:
- the service type
-
getEventInterceptorBuilders
Obtains theList
ofNamedEventInterceptorBuilder
s that have been defined for theServiceScheme
.Note: For those
ServiceScheme
s don't support event interceptors, the returned value must be an empty list.- Specified by:
getEventInterceptorBuilders
in interfaceServiceScheme
- Overrides:
getEventInterceptorBuilders
in classAbstractLocalCachingScheme<Object>
- Returns:
- an
List
overNamedEventInterceptorBuilder
s
-
isRunningClusterNeeded
public boolean isRunningClusterNeeded()Return true if a running cluster is needed before using a service.- Specified by:
isRunningClusterNeeded
in interfaceServiceBuilder
- Overrides:
isRunningClusterNeeded
in classAbstractLocalCachingScheme<Object>
- Returns:
true
if a running cluster is needed before using a service
-
realizeCache
Realizes aNamedCache
(possibly "ensuring it") based on the state of the builder, the providedParameterResolver
andMapBuilder
dependencies.The
MapBuilder
dependencies are required to satisfy the requirement when realizing aNamedCache
additionally involves realizing one or more internalMap
s.- Specified by:
realizeCache
in interfaceNamedCacheBuilder
- Overrides:
realizeCache
in classAbstractCachingScheme
- Parameters:
resolver
- the ParameterResolverdependencies
- theMapBuilder
dependencies- Returns:
- a
NamedCache
-
realizeMap
Realize aMap
based on the state of theMapBuilder
, resolvable parameters and providedMapBuilder.Dependencies
.- Specified by:
realizeMap
in interfaceMapBuilder
- Overrides:
realizeMap
in classAbstractCachingScheme
- Parameters:
resolver
- theParameterResolver
dependencies
- theMapBuilder.Dependencies
for realizing theMap
- Returns:
- a
Map
-
realize
Realizes (creates if necessary) an instance of a object of type T, using the providedParameterResolver
to resolve values any referencedParameter
s.- Specified by:
realize
in interfaceParameterizedBuilder<Object>
- Parameters:
resolver
- theParameterResolver
for resolving namedParameter
sloader
- theClassLoader
for loading any necessary classes and ifnull
theClassLoader
used to load the builder will be used insteadlistParameters
- an optionalParameterList
(may benull
) to be used for realizing the instance, eg: used as constructor parameters- Returns:
- an instance of T
-
realizes
Determines if theParameterizedBuilder
will realize an instance of the specified class (without requiring the builder to actually realize an object).This method is synonymous with the Java keyword
instanceof
but allows dynamic runtime type querying of the types of objects a builder may realize.- Specified by:
realizes
in interfaceParameterizedBuilder.ReflectionSupport
- Parameters:
clzClass
- the expected typeresolver
- theParameterResolver
to use for resolving necessaryParameter
sloader
- theClassLoader
for loading any necessary classes and ifnull
theClassLoader
used to load the builder will be used instead- Returns:
true
if theParameterizedBuilder
will realize an instance of the class,false
otherwise
-
validate
protected void validate()Validate the ClassScheme properties.- Overrides:
validate
in classAbstractScheme
-