Package com.clickhouse.client
Class ClickHouseNode.Builder
- java.lang.Object
-
- com.clickhouse.client.ClickHouseNode.Builder
-
- Enclosing class:
- ClickHouseNode
public static class ClickHouseNode.Builder extends Object
Mutable and non-thread safe builder.
-
-
Field Summary
Fields Modifier and Type Field Description protected InetSocketAddressaddressprotected Stringclusterprotected ClickHouseCredentialscredentialsprotected Stringdatabaseprotected Stringhostprotected Integerportprotected ClickHouseProtocolprotocolprotected Set<String>tagsprotected TimeZonetzprotected ClickHouseVersionversionprotected Integerweight
-
Constructor Summary
Constructors Modifier Constructor Description protectedBuilder()Default constructor.
-
Method Summary
-
-
-
Field Detail
-
cluster
protected String cluster
-
host
protected String host
-
port
protected Integer port
-
address
protected InetSocketAddress address
-
protocol
protected ClickHouseProtocol protocol
-
credentials
protected ClickHouseCredentials credentials
-
database
protected String database
-
weight
protected Integer weight
-
tz
protected TimeZone tz
-
version
protected ClickHouseVersion version
-
-
Method Detail
-
getCluster
protected String getCluster()
-
getAddress
protected InetSocketAddress getAddress()
-
getProtocol
protected ClickHouseProtocol getProtocol()
-
getCredentials
protected ClickHouseCredentials getCredentials()
-
getDatabase
protected String getDatabase()
-
getWeight
protected int getWeight()
-
getTimeZone
protected TimeZone getTimeZone()
-
getVersion
protected ClickHouseVersion getVersion()
-
cluster
public ClickHouseNode.Builder cluster(String cluster)
Sets cluster name.- Parameters:
cluster- cluster name, null meansClickHouseDefaults.CLUSTER- Returns:
- this builder
-
host
public ClickHouseNode.Builder host(String host)
Sets host name.- Parameters:
host- host name, null meansClickHouseDefaults.HOST- Returns:
- this builder
-
port
public ClickHouseNode.Builder port(Integer port)
Sets port number.- Parameters:
port- port number, null meansClickHouseDefaults.PORT- Returns:
- this builder
-
port
public ClickHouseNode.Builder port(ClickHouseProtocol protocol)
Sets protocol used by the port.- Parameters:
protocol- protocol, null meansClickHouseDefaults.PROTOCOL- Returns:
- this builder
-
port
public ClickHouseNode.Builder port(ClickHouseProtocol protocol, Integer port)
Sets protocol and port number.- Parameters:
protocol- protocol, null meansClickHouseDefaults.PROTOCOLport- number, null meansClickHouseDefaults.PORT- Returns:
- this builder
-
address
public ClickHouseNode.Builder address(InetSocketAddress address)
Sets socket address.- Parameters:
address- socket address, null meansClickHouseDefaults.HOSTandClickHouseDefaults.PORT- Returns:
- this builder
-
address
public ClickHouseNode.Builder address(ClickHouseProtocol protocol, InetSocketAddress address)
Sets protocol and socket address.- Parameters:
protocol- protocol, null meansClickHouseDefaults.PROTOCOLaddress- socket address, null meansClickHouseDefaults.HOSTandClickHouseDefaults.PORT- Returns:
- this builder
-
database
public ClickHouseNode.Builder database(String database)
Sets database name.- Parameters:
database- database name, null meansClickHouseDefaults.DATABASE- Returns:
- this builder
-
credentials
public ClickHouseNode.Builder credentials(ClickHouseCredentials credentials)
Sets credentials will be used when connecting to this node. This is optional as client will useClickHouseConfig.getDefaultCredentials()to connect to all nodes.- Parameters:
credentials- credentials, null meansClickHouseConfig.getDefaultCredentials()- Returns:
- this builder
-
addTag
public ClickHouseNode.Builder addTag(String tag)
Adds a tag for this node.- Parameters:
tag- tag for the node, null or duplicate tag will be ignored- Returns:
- this builder
-
removeTag
public ClickHouseNode.Builder removeTag(String tag)
Removes a tag from this node.- Parameters:
tag- tag to be removed, null value will be ignored- Returns:
- this builder
-
tags
public ClickHouseNode.Builder tags(String tag, String... more)
Sets all tags for this node. Use null or empty value to clear all existing tags.- Parameters:
tag- tag for the node, null will be ignoredmore- more tags for the node, null tag will be ignored- Returns:
- this builder
-
tags
public ClickHouseNode.Builder tags(Collection<String> tags)
Sets all tags for this node. Use null or empty value to clear all existing tags.- Parameters:
tags- list of tags for the node, null tag will be ignored- Returns:
- this builder
-
weight
public ClickHouseNode.Builder weight(Integer weight)
Sets weight of this node.- Parameters:
weight- weight of the node, null meansClickHouseDefaults.WEIGHT- Returns:
- this builder
-
timeZone
public ClickHouseNode.Builder timeZone(String tz)
Sets time zone of this node.- Parameters:
tz- time zone ID, could be null- Returns:
- this builder
-
timeZone
public ClickHouseNode.Builder timeZone(TimeZone tz)
Sets time zone of this node.- Parameters:
tz- time zone, could be null- Returns:
- this builder
-
version
public ClickHouseNode.Builder version(String version)
Sets vesion of this node.- Parameters:
version- version string, could be null- Returns:
- this builder
-
version
public ClickHouseNode.Builder version(ClickHouseVersion version)
Sets vesion of this node.- Parameters:
version- version, could be null- Returns:
- this builder
-
build
public ClickHouseNode build()
Creates a new node.- Returns:
- new node
-
-