Package com.clickhouse.client.config
Interface ClickHouseOption
-
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
ClickHouseClientOption
,ClickHouseDefaults
public interface ClickHouseOption extends Serializable
This defines a configuration option. To put it in a nutshell, an option is composed of key, default value(which implies type of the value) and description.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description static <T extends Serializable>
TfromString(String value, Class<T> clazz)
Converts given string to a typed value.Serializable
getDefaultValue()
Gets default value of the option.default Optional<String>
getDefaultValueFromEnvVar()
Gets trimmed default value from environment variable.default Optional<String>
getDefaultValueFromSysProp()
Gets trimmed default value from system property.String
getDescription()
Gets description of the option.default Serializable
getEffectiveDefaultValue()
Gets effective default value by considering default value defined in system property and environment variable.default <T> T
getEffectiveValue(T value)
Gets effective value by considering default value defined in system property and environment variable.String
getKey()
Gets key of the option.default String
getPrefix()
Gets prefix of environment variable and system property.Class<? extends Serializable>
getValueType()
Gets value type of the option.String
name()
Gets name of the option.
-
-
-
Method Detail
-
fromString
static <T extends Serializable> T fromString(String value, Class<T> clazz)
Converts given string to a typed value.- Type Parameters:
T
- type of the value- Parameters:
value
- value in string formatclazz
- non-null class of the value- Returns:
- typed value
-
getDefaultValue
Serializable getDefaultValue()
Gets default value of the option.- Returns:
- default value of the option
-
getDefaultValueFromEnvVar
default Optional<String> getDefaultValueFromEnvVar()
Gets trimmed default value from environment variable. By default the environment variable is named asgetPrefix()
+ "_" +name()
in upper case.- Returns:
- trimmed default value defined in environment variable
-
getDefaultValueFromSysProp
default Optional<String> getDefaultValueFromSysProp()
Gets trimmed default value from system property. By default the system property is named asgetPrefix()
+ "_" +name()
in lower case.- Returns:
- trimmed default value defined in system property
-
getDescription
String getDescription()
Gets description of the option.- Returns:
- description of the option
-
getEffectiveDefaultValue
default Serializable getEffectiveDefaultValue()
Gets effective default value by considering default value defined in system property and environment variable. It's same asgetDefaultValue()
if no system property and environment variable defined.- Returns:
- effective default value
-
getEffectiveValue
default <T> T getEffectiveValue(T value)
Gets effective value by considering default value defined in system property and environment variable. It's same asgetDefaultValue()
if the given value is null and no system property and environment variable defined.- Type Parameters:
T
- type of the value- Parameters:
value
- default value- Returns:
- effective value
-
getKey
String getKey()
Gets key of the option.- Returns:
- key of the option
-
getPrefix
default String getPrefix()
Gets prefix of environment variable and system property.- Returns:
- prefix of environment variable and system property
-
getValueType
Class<? extends Serializable> getValueType()
Gets value type of the option.- Returns:
- value type of the option, defaults to String
-
name
String name()
Gets name of the option.- Returns:
- name of the option
-
-