public class ResourcePoolsBuilder extends java.lang.Object implements Builder<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 |
---|---|
ResourcePools |
build()
Builds the
ResourcePools based on this builder's configuration. |
ResourcePoolsBuilder |
disk(long size,
MemoryUnit unit)
Convenience method to add a non persistent
ResourceType.Core.DISK pool. |
ResourcePoolsBuilder |
disk(long size,
MemoryUnit unit,
boolean persistent)
Convenience method to add a
ResourceType.Core.DISK pool specifying persistence. |
ResourcePoolsBuilder |
heap(long size,
ResourceUnit unit)
Convenience method to add a
ResourceType.Core.HEAP pool. |
static ResourcePoolsBuilder |
newResourcePoolsBuilder()
Creates a new
ResourcePoolsBuilder . |
static ResourcePoolsBuilder |
newResourcePoolsBuilder(ResourcePools pools)
Convenience method to get a builder from an existing
ResourcePools . |
ResourcePoolsBuilder |
offheap(long size,
MemoryUnit unit)
Convenience method to add a
ResourceType.Core.OFFHEAP pool. |
ResourcePoolsBuilder |
with(ResourceType type,
long size,
ResourceUnit unit,
boolean persistent)
Adds or replace the
ResourcePool of ResourceType in the returned builder. |
public static ResourcePoolsBuilder newResourcePoolsBuilder()
ResourcePoolsBuilder
.public static ResourcePoolsBuilder newResourcePoolsBuilder(ResourcePools pools)
ResourcePools
.pools
- the resource pools to build frompublic ResourcePoolsBuilder with(ResourceType type, long size, 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 persistentpublic ResourcePoolsBuilder heap(long size, ResourceUnit unit)
ResourceType.Core.HEAP
pool.size
- the pool sizeunit
- the pool size unitpublic ResourcePoolsBuilder offheap(long size, MemoryUnit unit)
ResourceType.Core.OFFHEAP
pool.size
- the pool sizeunit
- the pool size unitpublic ResourcePoolsBuilder disk(long size, MemoryUnit unit)
ResourceType.Core.DISK
pool.size
- the pool sizeunit
- the pool size unitpublic ResourcePoolsBuilder disk(long size, MemoryUnit unit, boolean persistent)
ResourceType.Core.DISK
pool specifying persistence.size
- the pool sizeunit
- the pool size unitpersistent
- if the pool is persistent or notpublic ResourcePools build()
ResourcePools
based on this builder's configuration.build
in interface Builder<ResourcePools>