Class CachePolicyBuilder
- java.lang.Object
-
- org.opendaylight.infrautils.caches.CachePolicyBuilder
-
@Generated("org.immutables.processor.ProxyProcessor") public final class CachePolicyBuilder extends Object
Builds instances of typeCachePolicy
. Initialize attributes and then invoke thebuild()
method to create an immutable instance.CachePolicyBuilder
is not thread-safe and generally should not be stored in a field or collection, but instead used immediately to create instances.
-
-
Constructor Summary
Constructors Constructor Description CachePolicyBuilder()
Creates a builder forCachePolicy
instances.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CachePolicy
build()
Builds a newCachePolicy
.CachePolicyBuilder
from(CachePolicy instance)
Fill a builder with attribute values from the providedCachePolicy
instance.CachePolicyBuilder
maxEntries(long maxEntries)
Initializes the value for themaxEntries
attribute.CachePolicyBuilder
statsEnabled(boolean statsEnabled)
Initializes the value for thestatsEnabled
attribute.
-
-
-
Constructor Detail
-
CachePolicyBuilder
public CachePolicyBuilder()
Creates a builder forCachePolicy
instances.new CachePolicyBuilder() .statsEnabled(boolean) // optional
statsEnabled
.maxEntries(long) // optionalmaxEntries
.build();
-
-
Method Detail
-
from
@CanIgnoreReturnValue public final CachePolicyBuilder from(CachePolicy instance)
Fill a builder with attribute values from the providedCachePolicy
instance. Regular attribute values will be replaced with those from the given instance. Absent optional values will not replace present values.- Parameters:
instance
- The instance from which to copy values- Returns:
this
builder for use in a chained invocation
-
statsEnabled
@CanIgnoreReturnValue public final CachePolicyBuilder statsEnabled(boolean statsEnabled)
Initializes the value for thestatsEnabled
attribute.If not set, this attribute will have a default value as returned by the initializer of
statsEnabled
.- Parameters:
statsEnabled
- The value for statsEnabled- Returns:
this
builder for use in a chained invocation
-
maxEntries
@CanIgnoreReturnValue public final CachePolicyBuilder maxEntries(long maxEntries)
Initializes the value for themaxEntries
attribute.If not set, this attribute will have a default value as returned by the initializer of
maxEntries
.- Parameters:
maxEntries
- The value for maxEntries- Returns:
this
builder for use in a chained invocation
-
build
public CachePolicy build()
Builds a newCachePolicy
.- Returns:
- An immutable instance of CachePolicy
- Throws:
IllegalStateException
- if any required attributes are missing
-
-