Package com.github.ambry.account
Class ContainerBuilder
- java.lang.Object
-
- com.github.ambry.account.ContainerBuilder
-
public class ContainerBuilder extends java.lang.Object
A builder class forContainer
. SinceContainer
is immutable, modifying aContainer
needs to build a newContainer
object with updated fields through this builder. AContainer
can be built in two ways: 1) from an existingContainer
object; and 2) by supplying required fields of aContainer
. This class is not thread safe.
-
-
Constructor Summary
Constructors Constructor Description ContainerBuilder(short id, java.lang.String name, Container.ContainerStatus status, java.lang.String description, short parentAccountId)
Constructor for aContainerBuilder
taking individual arguments.ContainerBuilder(Container origin)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Container
build()
Builds aContainer
object.ContainerBuilder
setBackupEnabled(boolean backupEnabled)
Sets the backup setting of theContainer
to buildContainerBuilder
setCacheable(boolean cacheable)
Sets the caching setting of theContainer
to buildContainerBuilder
setContentTypeWhitelistForFilenamesOnDownload(java.util.Set<java.lang.String> contentTypeWhitelistForFilenamesOnDownload)
Sets the whitelist for the content types for which filenames can be sent on downloadContainerBuilder
setDeleteTriggerTime(long deleteTriggerTime)
Sets the delete trigger time of theContainer
to build.ContainerBuilder
setDescription(java.lang.String description)
Sets the description of theContainer
to build.ContainerBuilder
setEncrypted(boolean encrypted)
Sets the encryption setting of theContainer
to build.ContainerBuilder
setId(short id)
Sets the ID of theContainer
to build.ContainerBuilder
setLastModifiedTime(long lastModifiedTime)
Sets the created/modified time of theContainer
ContainerBuilder
setMediaScanDisabled(boolean mediaScanDisabled)
Sets the media scan disabled setting of theContainer
to buildContainerBuilder
setName(java.lang.String name)
Sets the name of theContainer
to build.ContainerBuilder
setParentAccountId(short parentAccountId)
ContainerBuilder
setPreviouslyEncrypted(boolean previouslyEncrypted)
Sets the previously encrypted setting of theContainer
to build.ContainerBuilder
setReplicationPolicy(java.lang.String replicationPolicy)
Sets the replication policy desired by theContainer
.ContainerBuilder
setSecurePathRequired(boolean securePathRequired)
Sets the secure path validation required setting of theContainer
.ContainerBuilder
setSnapshotVersion(int snapshotVersion)
Sets the snapshot version of theContainer
to build.ContainerBuilder
setStatus(Container.ContainerStatus status)
Sets the status of theContainer
to build.ContainerBuilder
setTtlRequired(boolean ttlRequired)
Sets the ttl required setting of theContainer
.
-
-
-
Constructor Detail
-
ContainerBuilder
public ContainerBuilder(Container origin)
Constructor. This will allow building a newContainer
from an existingContainer
. The builder will include all the information of the existingContainer
. This constructor should be used when modifying an existing container.- Parameters:
origin
- TheContainer
to build from.
-
ContainerBuilder
public ContainerBuilder(short id, java.lang.String name, Container.ContainerStatus status, java.lang.String description, short parentAccountId)
Constructor for aContainerBuilder
taking individual arguments.
-
-
Method Detail
-
setId
public ContainerBuilder setId(short id)
Sets the ID of theContainer
to build.- Parameters:
id
- The ID to set.- Returns:
- This builder.
-
setName
public ContainerBuilder setName(java.lang.String name)
Sets the name of theContainer
to build.- Parameters:
name
- The name to set.- Returns:
- This builder.
-
setStatus
public ContainerBuilder setStatus(Container.ContainerStatus status)
Sets the status of theContainer
to build.- Parameters:
status
- The status to set.- Returns:
- This builder.
-
setDeleteTriggerTime
public ContainerBuilder setDeleteTriggerTime(long deleteTriggerTime)
Sets the delete trigger time of theContainer
to build.
-
setDescription
public ContainerBuilder setDescription(java.lang.String description)
Sets the description of theContainer
to build.- Parameters:
description
- The description to set.- Returns:
- This builder.
-
setParentAccountId
public ContainerBuilder setParentAccountId(short parentAccountId)
- Parameters:
parentAccountId
- The parentAccount
ID to set.- Returns:
- This builder.
-
setEncrypted
public ContainerBuilder setEncrypted(boolean encrypted)
Sets the encryption setting of theContainer
to build.- Parameters:
encrypted
- The encryption setting to set.- Returns:
- This builder.
-
setPreviouslyEncrypted
public ContainerBuilder setPreviouslyEncrypted(boolean previouslyEncrypted)
Sets the previously encrypted setting of theContainer
to build.- Parameters:
previouslyEncrypted
- The previouslyEncrypted setting to set.- Returns:
- This builder.
-
setCacheable
public ContainerBuilder setCacheable(boolean cacheable)
Sets the caching setting of theContainer
to build- Parameters:
cacheable
- The cache setting to set.- Returns:
- This builder.
-
setBackupEnabled
public ContainerBuilder setBackupEnabled(boolean backupEnabled)
Sets the backup setting of theContainer
to build- Parameters:
backupEnabled
- The backup setting to set.- Returns:
- This builder.
-
setMediaScanDisabled
public ContainerBuilder setMediaScanDisabled(boolean mediaScanDisabled)
Sets the media scan disabled setting of theContainer
to build- Parameters:
mediaScanDisabled
- The media scan disabled setting to set.- Returns:
- This builder.
-
setTtlRequired
public ContainerBuilder setTtlRequired(boolean ttlRequired)
Sets the ttl required setting of theContainer
.- Parameters:
ttlRequired
- The ttlRequired setting to set.- Returns:
- This builder.
-
setSecurePathRequired
public ContainerBuilder setSecurePathRequired(boolean securePathRequired)
Sets the secure path validation required setting of theContainer
.- Parameters:
securePathRequired
- The securePathRequired setting to set.- Returns:
- This builder.
-
setReplicationPolicy
public ContainerBuilder setReplicationPolicy(java.lang.String replicationPolicy)
Sets the replication policy desired by theContainer
.- Parameters:
replicationPolicy
- the replication policy desired by the container- Returns:
- This builder.
-
setContentTypeWhitelistForFilenamesOnDownload
public ContainerBuilder setContentTypeWhitelistForFilenamesOnDownload(java.util.Set<java.lang.String> contentTypeWhitelistForFilenamesOnDownload)
Sets the whitelist for the content types for which filenames can be sent on download- Parameters:
contentTypeWhitelistForFilenamesOnDownload
- the whitelist for the content types for which filenames can be sent on download- Returns:
- This builder.
-
setLastModifiedTime
public ContainerBuilder setLastModifiedTime(long lastModifiedTime)
Sets the created/modified time of theContainer
- Parameters:
lastModifiedTime
- epoch time in milliseconds.- Returns:
- This builder.
-
setSnapshotVersion
public ContainerBuilder setSnapshotVersion(int snapshotVersion)
Sets the snapshot version of theContainer
to build.- Parameters:
snapshotVersion
- The version to set.- Returns:
- This builder.
-
-