public static final class RetentionPolicy.Builder extends Object
RetentionPolicy.| Constructor and Description |
|---|
Builder(String name,
Duration duration)
Initializes a new instance setting the required fields.
|
| Modifier and Type | Method and Description |
|---|---|
RetentionPolicy |
build()
Constructs a retention policy instance from the values set in this builder.
|
RetentionPolicy.Builder |
duration(Duration duration)
Sets the
RetentionPolicy.duration for the retention policy. |
RetentionPolicy.Builder |
isDefault(boolean isDefault)
Sets a value indicating whether this retention policy should be the default retention
policy.
|
RetentionPolicy.Builder |
replication(int replication)
Sets the
replication factor for the retention policy. |
RetentionPolicy.Builder |
shardDuration(Duration shardDuration)
Sets the
shard duration for the retention policy. |
public Builder(String name, Duration duration)
The fields specified in this constructor are mandatory, the rest are optional and if not set will fall back to default values.
name - name of the retention policyduration - duration of the retention policyRetentionPolicy.durationpublic RetentionPolicy.Builder duration(Duration duration)
RetentionPolicy.duration for the retention policy.duration - the retention policy durationpublic RetentionPolicy.Builder replication(int replication)
replication factor for the retention policy.replication - number of replicas, must be positivepublic RetentionPolicy.Builder shardDuration(Duration shardDuration)
shard duration for the retention policy.shardDuration - the shard duration to use, must not be null or negativepublic RetentionPolicy.Builder isDefault(boolean isDefault)
If not set, this value defaults to false.
isDefault - whether the retention policy is the default onepublic RetentionPolicy build()
IllegalStateException - if any of the values set in this builder are illegalCopyright © 2020. All rights reserved.