public class ResourcePoolsBuilder
extends java.lang.Object
implements org.ehcache.config.Builder<org.ehcache.config.ResourcePools>
ResourcePoolsBuilder enables building ResourcePools configurations using a fluent style.
As with all Ehcache builders, all instances are immutable and calling any method on the builder will return a new instance without modifying the one on which the method was called. This enables the sharing of builder instances without any risk of seeing them modified by code elsewhere.
| Modifier and Type | Method and Description |
|---|---|
org.ehcache.config.ResourcePools |
build()
Builds the
ResourcePools based on this builder's configuration. |
ResourcePoolsBuilder |
disk(long size,
org.ehcache.config.units.MemoryUnit unit)
Convenience method to add a non persistent
disk pool. |
ResourcePoolsBuilder |
disk(long size,
org.ehcache.config.units.MemoryUnit unit,
boolean persistent)
Convenience method to add a
disk pool specifying persistence. |
static ResourcePoolsBuilder |
heap(long entries)
Creates a new
ResourcePoolsBuilder with a heap pool sized
in entries |
ResourcePoolsBuilder |
heap(long size,
org.ehcache.config.ResourceUnit unit)
Convenience method to add a
heap pool. |
static ResourcePoolsBuilder |
newResourcePoolsBuilder()
Creates a new
ResourcePoolsBuilder. |
static ResourcePoolsBuilder |
newResourcePoolsBuilder(org.ehcache.config.ResourcePools pools)
Convenience method to get a builder from an existing
ResourcePools. |
ResourcePoolsBuilder |
offheap(long size,
org.ehcache.config.units.MemoryUnit unit)
Convenience method to add an
offheap pool. |
ResourcePoolsBuilder |
with(org.ehcache.config.ResourcePool resourcePool)
Add the
ResourcePool of ResourceType in the returned builder. |
ResourcePoolsBuilder |
with(org.ehcache.config.ResourceType<org.ehcache.config.SizedResourcePool> type,
long size,
org.ehcache.config.ResourceUnit unit,
boolean persistent)
Add the
ResourcePool of ResourceType in the returned builder. |
ResourcePoolsBuilder |
withReplacing(org.ehcache.config.ResourcePool resourcePool)
Add or replace the
ResourcePool of ResourceType in the returned builder. |
public static ResourcePoolsBuilder newResourcePoolsBuilder()
ResourcePoolsBuilder.public static ResourcePoolsBuilder newResourcePoolsBuilder(org.ehcache.config.ResourcePools pools)
ResourcePools.pools - the resource pools to build frompublic static ResourcePoolsBuilder heap(long entries)
ResourcePoolsBuilder with a heap pool sized
in entriesentries - the maximum number of mappings to cachepublic ResourcePoolsBuilder with(org.ehcache.config.ResourcePool resourcePool)
ResourcePool of ResourceType in the returned builder.resourcePool - the non-null resource pool to addjava.lang.IllegalArgumentException - if the set of resource pools already contains a pool for typepublic ResourcePoolsBuilder withReplacing(org.ehcache.config.ResourcePool resourcePool)
ResourcePool of ResourceType in the returned builder.resourcePool - the non-null resource pool to add/replacepublic ResourcePoolsBuilder with(org.ehcache.config.ResourceType<org.ehcache.config.SizedResourcePool> type, long size, org.ehcache.config.ResourceUnit unit, boolean persistent)
ResourcePool of ResourceType in the returned builder.type - the resource typesize - the pool sizeunit - the pool size unitpersistent - if the pool is to be persistentjava.lang.IllegalArgumentException - if the set of resource pools already contains a pool for typepublic ResourcePoolsBuilder heap(long size, org.ehcache.config.ResourceUnit unit)
heap pool.size - the pool sizeunit - the pool size unitjava.lang.IllegalArgumentException - if the set of resource pools already contains a heap resourcepublic ResourcePoolsBuilder offheap(long size, org.ehcache.config.units.MemoryUnit unit)
offheap pool.size - the pool sizeunit - the pool size unitjava.lang.IllegalArgumentException - if the set of resource pools already contains an offheap resourcepublic ResourcePoolsBuilder disk(long size, org.ehcache.config.units.MemoryUnit unit)
disk pool.size - the pool sizeunit - the pool size unitjava.lang.IllegalArgumentException - if the set of resource pools already contains a disk resourcepublic ResourcePoolsBuilder disk(long size, org.ehcache.config.units.MemoryUnit unit, boolean persistent)
disk pool specifying persistence.size - the pool sizeunit - the pool size unitpersistent - if the pool is persistent or notjava.lang.IllegalArgumentException - if the set of resource pools already contains a disk resourcepublic org.ehcache.config.ResourcePools build()
ResourcePools based on this builder's configuration.build in interface org.ehcache.config.Builder<org.ehcache.config.ResourcePools>