Class DefaultBucketSettings.Builder
- java.lang.Object
-
- com.couchbase.client.java.cluster.DefaultBucketSettings.Builder
-
- All Implemented Interfaces:
BucketSettings
- Enclosing class:
- DefaultBucketSettings
public static class DefaultBucketSettings.Builder extends Object implements BucketSettings
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DefaultBucketSettings
build()
DefaultBucketSettings
build(JsonObject raw)
Build theBucketSettings
from the data aggregated by this builder, and set itsBucketSettings.raw()
representation as well.CompressionMode
compressionMode()
The different compression modes for the bucket.DefaultBucketSettings.Builder
compressionMode(CompressionMode compressionMode)
Map<String,Object>
customSettings()
A map of map of advanced settings that are not covered by the native methods of the object but still need to be set when configuring a bucket.EjectionMethod
ejectionMethod()
The ejection method available for the bucket.DefaultBucketSettings.Builder
ejectionMethod(EjectionMethod ejectionMethod)
boolean
enableFlush()
If flush is enabled.DefaultBucketSettings.Builder
enableFlush(boolean enableFlush)
boolean
indexReplicas()
If replicas are indexed.DefaultBucketSettings.Builder
indexReplicas(boolean indexReplicas)
String
name()
The name of the bucket.DefaultBucketSettings.Builder
name(String name)
String
password()
The password of the bucket.DefaultBucketSettings.Builder
password(String password)
int
port()
The optional proxy port.DefaultBucketSettings.Builder
port(int port)
int
quota()
The bucket quota.DefaultBucketSettings.Builder
quota(int quota)
JsonObject
raw()
A raw representation of the bucket settings when acquired from the server.int
replicas()
Number of replicas.DefaultBucketSettings.Builder
replicas(int replicas)
BucketType
type()
The type of the bucket.DefaultBucketSettings.Builder
type(BucketType type)
DefaultBucketSettings.Builder
withSetting(String key, Object value)
Add a custom setting to the bucket settings (ie.DefaultBucketSettings.Builder
withSettings(Map<String,Object> customSettings)
Add several custom settings to the bucket settings (ie.
-
-
-
Method Detail
-
name
public String name()
Description copied from interface:BucketSettings
The name of the bucket.- Specified by:
name
in interfaceBucketSettings
- Returns:
- name of the bucket.
-
name
public DefaultBucketSettings.Builder name(String name)
-
type
public BucketType type()
Description copied from interface:BucketSettings
The type of the bucket.- Specified by:
type
in interfaceBucketSettings
- Returns:
- type of the bucket.
-
type
public DefaultBucketSettings.Builder type(BucketType type)
-
quota
public int quota()
Description copied from interface:BucketSettings
The bucket quota.- Specified by:
quota
in interfaceBucketSettings
- Returns:
- bucket quota.
-
quota
public DefaultBucketSettings.Builder quota(int quota)
-
port
public int port()
Description copied from interface:BucketSettings
The optional proxy port.- Specified by:
port
in interfaceBucketSettings
- Returns:
- proxy port.
-
port
public DefaultBucketSettings.Builder port(int port)
-
password
public String password()
Description copied from interface:BucketSettings
The password of the bucket.- Specified by:
password
in interfaceBucketSettings
- Returns:
- password.
-
password
public DefaultBucketSettings.Builder password(String password)
-
replicas
public int replicas()
Description copied from interface:BucketSettings
Number of replicas.- Specified by:
replicas
in interfaceBucketSettings
- Returns:
- number of replicas.
-
replicas
public DefaultBucketSettings.Builder replicas(int replicas)
-
indexReplicas
public boolean indexReplicas()
Description copied from interface:BucketSettings
If replicas are indexed.- Specified by:
indexReplicas
in interfaceBucketSettings
- Returns:
- indexing replicas.
-
indexReplicas
public DefaultBucketSettings.Builder indexReplicas(boolean indexReplicas)
-
enableFlush
public boolean enableFlush()
Description copied from interface:BucketSettings
If flush is enabled.- Specified by:
enableFlush
in interfaceBucketSettings
- Returns:
- flush enabled.
-
enableFlush
public DefaultBucketSettings.Builder enableFlush(boolean enableFlush)
-
compressionMode
public CompressionMode compressionMode()
Description copied from interface:BucketSettings
The different compression modes for the bucket.- Specified by:
compressionMode
in interfaceBucketSettings
- Returns:
- the compression mode selected.
-
compressionMode
public DefaultBucketSettings.Builder compressionMode(CompressionMode compressionMode)
-
ejectionMethod
public EjectionMethod ejectionMethod()
Description copied from interface:BucketSettings
The ejection method available for the bucket.- Specified by:
ejectionMethod
in interfaceBucketSettings
- Returns:
- the ejection method selected.
-
ejectionMethod
public DefaultBucketSettings.Builder ejectionMethod(EjectionMethod ejectionMethod)
-
customSettings
public Map<String,Object> customSettings()
Description copied from interface:BucketSettings
A map of map of advanced settings that are not covered by the native methods of the object but still need to be set when configuring a bucket. To get a full raw representation of an existing bucket's configuration, seeBucketSettings.raw()
instead.- Specified by:
customSettings
in interfaceBucketSettings
- Returns:
- the map of custom advanced settings to use when configuring the bucket.
-
raw
public JsonObject raw()
Description copied from interface:BucketSettings
A raw representation of the bucket settings when acquired from the server. This can be used to get any missing information about the bucket that isn't covered by native methods. To configure a bucket and add settings that are not covered by native methods either, you should instead seeBucketSettings.customSettings()
.- Specified by:
raw
in interfaceBucketSettings
- Returns:
- the raw representation of the whole bucket settings, as returned by the server, or
an empty
JsonObject
if not applicable.
-
withSetting
public DefaultBucketSettings.Builder withSetting(String key, Object value)
Add a custom setting to the bucket settings (ie. one that is not covered by a native method).- Parameters:
key
- the setting's key.value
- the setting's value.- Returns:
- the Builder for chaining.
-
withSettings
public DefaultBucketSettings.Builder withSettings(Map<String,Object> customSettings)
Add several custom settings to the bucket settings (ie. settings not covered by a native method).- Parameters:
customSettings
- the settings to add.- Returns:
- the Builder for chaining.
-
build
public DefaultBucketSettings build()
-
build
public DefaultBucketSettings build(JsonObject raw)
Build theBucketSettings
from the data aggregated by this builder, and set itsBucketSettings.raw()
representation as well.- Parameters:
raw
- the raw representation for the settings, from the server.- Returns:
- the new
BucketSettings
.
-
-