Interface FluentConfigurationBuilder<B extends FluentConfigurationBuilder<?>>
- Type Parameters:
B- builder sub-type
- All Superinterfaces:
Builder<Configuration>
Configuration instances.-
Method Summary
Modifier and TypeMethodDescriptionCacheConfiguration<?,?> Return the cache configuration for the given alias.Return the configured classloader instance.default <C extends ServiceCreationConfiguration<?,?>>
CgetService(Class<C> configurationType) Return the unique service creation configuration of the given type.<C extends ServiceCreationConfiguration<?,?>>
Collection<C>getServices(Class<C> configurationType) Return the service creation configurations of the given type.updateCache(String alias, UnaryOperator<FluentCacheConfigurationBuilder<?, ?, ?>> update) Updates the configuration of the identified cache.updateCaches(UnaryOperator<FluentCacheConfigurationBuilder<?, ?, ?>> update) Updates the configuration of the all caches.<R,C extends ServiceCreationConfiguration<?, R>>
BupdateServices(Class<C> clazz, UnaryOperator<R> update) Updates all service creation configurations of the given type.Updates the configured shared resource pools.default BwithCache(String alias, Builder<? extends CacheConfiguration<?, ?>> builder) Adds the cache configuration built by a builder to this configuration.withCache(String alias, CacheConfiguration<?, ?> config) Adds the given cache to this configuration.withClassLoader(ClassLoader classLoader) Sets the given class loader as the cache manager classloaderRemoves any provided class loader returning to default behaviorwithoutCache(String alias) Removes the given cache from this configuration.default BwithoutServices(Class<? extends ServiceCreationConfiguration<?, ?>> clazz) Removes all service creation configurations of the given type from this configuration.<C extends ServiceCreationConfiguration<?,?>>
BwithoutServices(Class<C> clazz, Predicate<? super C> predicate) Removes all service creation configurations of the given type that pass the predicate.default BwithService(Builder<? extends ServiceCreationConfiguration<?, ?>> builder) Adds a service creation configuration built by the given builder to this configuration.withService(ServiceCreationConfiguration<?, ?> config) Adds a service creation configuration to this configuration.default BwithSharedResources(Builder<? extends ResourcePools> builder) Convenience method to set the sharedResourcePoolsthrough aBuilder.withSharedResources(ResourcePools resourcePools) Sets the sharedResourcePoolsin the returned builder.
-
Method Details
-
getCache
Return the cache configuration for the given alias.- Parameters:
alias- cache alias- Returns:
- associated cache configuration
- See Also:
-
withCache
Adds the given cache to this configuration.This will overwrite any existing configuration for the cache with this alias.
- Parameters:
alias- cache aliasconfig- cache configuration- Returns:
- an updated builder
- See Also:
-
withCache
Adds the cache configuration built by a builder to this configuration.This will overwrite any existing configuration for the cache with this alias.
- Parameters:
alias- cache aliasbuilder- cache configuration builder- Returns:
- an updated builder
- See Also:
-
withoutCache
Removes the given cache from this configuration.- Parameters:
alias- cache alias- Returns:
- an updated builder
- See Also:
-
updateCache
B updateCache(String alias, UnaryOperator<FluentCacheConfigurationBuilder<?, ?, throws IllegalArgumentException?>> update) Updates the configuration of the identified cache.If a cache exists for the given alias then the following process is performed:
- The configuration is converted to a builder seeded with that configuration.
- The builder is then transformed using the
updateunary operator. - A new configuration is generated by calling
build()on the resultant builder. - The new configuration is associated with the given alias.
aliasthen anIllegalStateExceptionwill be thrown.- Parameters:
alias- cache aliasupdate- configuration mutation function- Returns:
- an updated builder
- Throws:
IllegalArgumentException- if no cache configuration exists foralias- See Also:
-
updateCaches
Updates the configuration of the all caches.For every existing cache the following process is performed:
- The configuration is converted to a builder seeded with that configuration.
- The builder is then transformed using the
updateunary operator. - A new configuration is generated by calling
build()on the resultant builder. - The new configuration is associated with the given alias.
- Parameters:
update- configuration mutation function- Returns:
- an updated builder
- See Also:
-
getService
default <C extends ServiceCreationConfiguration<?,?>> C getService(Class<C> configurationType) throws IllegalArgumentException Return the unique service creation configuration of the given type.If there are multiple configuration instances of this type (or subtypes) then an
IllegalArgumentExceptionwill be thrown.- Type Parameters:
C- configuration type- Parameters:
configurationType- desired configuration type- Returns:
- the given configuration type
- Throws:
IllegalArgumentException- if there are multiple instances of this type- See Also:
-
getServices
<C extends ServiceCreationConfiguration<?,?>> Collection<C> getServices(Class<C> configurationType) Return the service creation configurations of the given type.- Type Parameters:
C- configuration type- Parameters:
configurationType- desired configuration type- Returns:
- all services of this type
- See Also:
-
withService
Adds a service creation configuration to this configuration.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) );- Parameters:
config- service creation configuration- Returns:
- an updated builder
- See Also:
-
withService
Adds a service creation configuration built by the given builder to this configuration.This will remove any existing configurations that are incompatible with the supplied one.
- Parameters:
builder- service creation configuration builder- Returns:
- an updated builder
- See Also:
-
withoutServices
Removes all service creation configurations of the given type from this configuration.- Parameters:
clazz- service configuration type- Returns:
- an updated builder
- See Also:
-
withoutServices
<C extends ServiceCreationConfiguration<?,?>> B withoutServices(Class<C> clazz, Predicate<? super C> predicate) Removes all service creation configurations of the given type that pass the predicate.- Type Parameters:
C- configuration type- Parameters:
clazz- service configuration typepredicate- predicate controlling removal- Returns:
- an updated builder
- See Also:
-
updateServices
<R,C extends ServiceCreationConfiguration<?, B updateServicesR>> (Class<C> clazz, UnaryOperator<R> update) throws IllegalStateException Updates all service creation configurations of the given type.For each existing service creation configuration instance that is assignment compatible with
clazzthe following process is performed:- The configuration is converted to its detached representations using the
ServiceCreationConfiguration.derive()method. - The detached representation is transformed using the
updateunary operator. - A new configuration is generated by passing the transformed detached representation to the existing
configurations
ServiceCreationConfiguration.build(Object)method. - The new configuration is added to the builders service configuration set.
clazzthen anIllegalStateExceptionwill be thrown.- Type Parameters:
R- configuration detached representation typeC- service configuration type- Parameters:
clazz- service creation configuration typeupdate- configuration mutation function- Returns:
- an updated builder
- Throws:
IllegalStateException- if no configurations of typeCexist- See Also:
- The configuration is converted to its detached representations using the
-
getClassLoader
ClassLoader getClassLoader()Return the configured classloader instance.- Returns:
- configured classloader
- See Also:
-
withClassLoader
Sets the given class loader as the cache manager classloader- Parameters:
classLoader- cache manager classloader- Returns:
- an updated builder
- See Also:
-
withDefaultClassLoader
B withDefaultClassLoader()Removes any provided class loader returning to default behavior- Returns:
- an updated builder
- See Also:
-