B
- builder sub-typepublic interface FluentConfigurationBuilder<B extends FluentConfigurationBuilder<?>> extends Builder<Configuration>
Configuration
instances.Modifier and Type | Method and Description |
---|---|
CacheConfiguration<?,?> |
getCache(java.lang.String alias)
Return the cache configuration for the given alias.
|
java.lang.ClassLoader |
getClassLoader()
Return the configured classloader instance.
|
default <C extends ServiceCreationConfiguration<?,?>> |
getService(java.lang.Class<C> configurationType)
Return the unique service creation configuration of the given type.
|
<C extends ServiceCreationConfiguration<?,?>> |
getServices(java.lang.Class<C> configurationType)
Return the service creation configurations of the given type.
|
B |
updateCache(java.lang.String alias,
java.util.function.UnaryOperator<FluentCacheConfigurationBuilder<?,?,?>> update)
Updates the configuration of the identified cache.
|
B |
updateCaches(java.util.function.UnaryOperator<FluentCacheConfigurationBuilder<?,?,?>> update)
Updates the configuration of the all caches.
|
<R,C extends ServiceCreationConfiguration<?,R>> |
updateServices(java.lang.Class<C> clazz,
java.util.function.UnaryOperator<R> update)
Updates all service creation configurations of the given type.
|
default B |
withCache(java.lang.String alias,
Builder<? extends CacheConfiguration<?,?>> builder)
Adds the cache configuration built by a builder to this configuration.
|
B |
withCache(java.lang.String alias,
CacheConfiguration<?,?> config)
Adds the given cache to this configuration.
|
B |
withClassLoader(java.lang.ClassLoader classLoader)
Sets the given class loader as the cache manager classloader
|
B |
withDefaultClassLoader()
Removes any provided class loader returning to default behavior
|
B |
withoutCache(java.lang.String alias)
Removes the given cache from this configuration.
|
default B |
withoutServices(java.lang.Class<? extends ServiceCreationConfiguration<?,?>> clazz)
Removes all service creation configurations of the given type from this configuration.
|
<C extends ServiceCreationConfiguration<?,?>> |
withoutServices(java.lang.Class<C> clazz,
java.util.function.Predicate<? super C> predicate)
Removes all service creation configurations of the given type that pass the predicate.
|
default B |
withService(Builder<? extends ServiceCreationConfiguration<?,?>> builder)
Adds a service creation configuration built by the given builder to this configuration.
|
B |
withService(ServiceCreationConfiguration<?,?> config)
Adds a service creation configuration to this configuration.
|
CacheConfiguration<?,?> getCache(java.lang.String alias)
alias
- cache aliaswithCache(String, CacheConfiguration)
,
withCache(String, Builder)
,
updateCache(String, UnaryOperator)
,
withoutCache(String)
,
updateCaches(UnaryOperator)
B withCache(java.lang.String alias, CacheConfiguration<?,?> config)
This will overwrite any existing configuration for the cache with this alias.
alias
- cache aliasconfig
- cache configurationgetCache(String)
,
withCache(String, Builder)
,
updateCache(String, UnaryOperator)
,
withoutCache(String)
,
updateCaches(UnaryOperator)
default B withCache(java.lang.String alias, Builder<? extends CacheConfiguration<?,?>> builder)
This will overwrite any existing configuration for the cache with this alias.
alias
- cache aliasbuilder
- cache configuration buildergetCache(String)
,
withCache(String, Builder)
,
updateCache(String, UnaryOperator)
,
withoutCache(String)
,
updateCaches(UnaryOperator)
B withoutCache(java.lang.String alias)
alias
- cache aliasgetCache(String)
,
withCache(String, CacheConfiguration)
,
withCache(String, Builder)
,
updateCache(String, UnaryOperator)
,
updateCaches(UnaryOperator)
B updateCache(java.lang.String alias, java.util.function.UnaryOperator<FluentCacheConfigurationBuilder<?,?,?>> update) throws java.lang.IllegalArgumentException
If a cache exists for the given alias then the following process is performed:
update
unary operator.build()
on the resultant builder.alias
then an IllegalStateException
will be thrown.alias
- cache aliasupdate
- configuration mutation functionjava.lang.IllegalArgumentException
- if no cache configuration exists for alias
getCache(String)
,
withCache(String, CacheConfiguration)
,
withCache(String, Builder)
,
withoutCache(String)
,
updateCaches(UnaryOperator)
B updateCaches(java.util.function.UnaryOperator<FluentCacheConfigurationBuilder<?,?,?>> update)
For every existing cache the following process is performed:
update
unary operator.build()
on the resultant builder.update
- configuration mutation functiongetCache(String)
,
withCache(String, CacheConfiguration)
,
withCache(String, Builder)
,
updateCache(String, UnaryOperator)
,
withoutCache(String)
default <C extends ServiceCreationConfiguration<?,?>> C getService(java.lang.Class<C> configurationType) throws java.lang.IllegalArgumentException
If there are multiple configuration instances of this type (or subtypes) then an IllegalArgumentException
will be thrown.
C
- configuration typeconfigurationType
- desired configuration typejava.lang.IllegalArgumentException
- if there are multiple instances of this typegetServices(Class)
,
withService(ServiceCreationConfiguration)
,
withService(Builder)
,
withoutServices(Class)
,
withoutServices(Class, Predicate)
,
updateServices(Class, UnaryOperator)
<C extends ServiceCreationConfiguration<?,?>> java.util.Collection<C> getServices(java.lang.Class<C> configurationType)
C
- configuration typeconfigurationType
- desired configuration typegetService(Class)
,
withService(ServiceCreationConfiguration)
,
withService(Builder)
,
withoutServices(Class)
,
withoutServices(Class, Predicate)
,
updateServices(Class, UnaryOperator)
B withService(ServiceCreationConfiguration<?,?> config)
This will remove any existing service creation configurations that are incompatible with the supplied one. This removal is equivalent to the following:
configurations.removeIf(
existing -> !config.compatibleWith(existing) || !existing.compatibleWith(config)
);
config
- service creation configurationServiceCreationConfiguration.compatibleWith(ServiceCreationConfiguration)
,
getService(Class)
,
getServices(Class)
,
withService(Builder)
,
withoutServices(Class)
,
withoutServices(Class, Predicate)
,
updateServices(Class, UnaryOperator)
default B withService(Builder<? extends ServiceCreationConfiguration<?,?>> builder)
This will remove any existing configurations that are incompatible with the supplied one.
builder
- service creation configuration buildergetService(Class)
,
getServices(Class)
,
withService(ServiceCreationConfiguration)
,
withoutServices(Class)
,
withoutServices(Class, Predicate)
,
updateServices(Class, UnaryOperator)
default B withoutServices(java.lang.Class<? extends ServiceCreationConfiguration<?,?>> clazz)
clazz
- service configuration typegetService(Class)
,
getServices(Class)
,
withService(ServiceCreationConfiguration)
,
withService(Builder)
,
withoutServices(Class, Predicate)
,
updateServices(Class, UnaryOperator)
<C extends ServiceCreationConfiguration<?,?>> B withoutServices(java.lang.Class<C> clazz, java.util.function.Predicate<? super C> predicate)
C
- configuration typeclazz
- service configuration typepredicate
- predicate controlling removalgetService(Class)
,
getServices(Class)
,
withService(ServiceCreationConfiguration)
,
withService(Builder)
,
withoutServices(Class)
,
updateServices(Class, UnaryOperator)
<R,C extends ServiceCreationConfiguration<?,R>> B updateServices(java.lang.Class<C> clazz, java.util.function.UnaryOperator<R> update) throws java.lang.IllegalStateException
For each existing service creation configuration instance that is assignment compatible with clazz
the
following process is performed:
ServiceCreationConfiguration.derive()
method.update
unary operator.ServiceCreationConfiguration.build(Object)
method.clazz
then an
IllegalStateException
will be thrown.R
- configuration detached representation typeC
- service configuration typeclazz
- service creation configuration typeupdate
- configuration mutation functionjava.lang.IllegalStateException
- if no configurations of type C
existgetService(Class)
,
getServices(Class)
,
withService(ServiceCreationConfiguration)
,
withService(Builder)
,
withoutServices(Class)
,
withoutServices(Class, Predicate)
java.lang.ClassLoader getClassLoader()
withClassLoader(ClassLoader)
,
withDefaultClassLoader()
B withClassLoader(java.lang.ClassLoader classLoader)
classLoader
- cache manager classloadergetClassLoader()
,
withDefaultClassLoader()
B withDefaultClassLoader()
getClassLoader()
,
withClassLoader(ClassLoader)