Package com.clickhouse.config
Interface ClickHouseOption
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
ClickHouseDefaultOption
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
Modifier and TypeMethodDescriptionstatic <T extends Serializable>
TfromString(String value, Class<T> clazz) Converts given string to a typed value.static <T extends Serializable>
TfromString(String value, T defaultValue) Converts given string to typed value.Gets default value of the option.Gets trimmed default value from environment variable.Gets trimmed default value from system property.Gets description of the option.default SerializableGets effective default value by considering default value defined in system property and environment variable.default <T> TgetEffectiveValue(T value) Gets effective value by considering default value defined in system property and environment variable.default StringGets environment variable for the option.getKey()Gets key of the option.default StringGets prefix of environment variable and system property.default StringGets system property for the option.Class<? extends Serializable>Gets value type of the option.name()Gets name of the option.toKeyValuePairs(String str) Converts given string to key value pairs.
-
Method Details
-
toKeyValuePairs
Converts given string to key value pairs.- Parameters:
str- string- Returns:
- non-null key value pairs
-
fromString
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:
- non-null typed value
-
fromString
Converts given string to typed value. Whenvalueis null or blank,defaultValuewill be returned.- Type Parameters:
T- type of the value- Parameters:
value- value in string formatdefaultValue- non-null default value- Returns:
- non-null typed value
-
getDefaultValue
Serializable getDefaultValue()Gets default value of the option.- Returns:
- default value of the option
-
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
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
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
Gets prefix of environment variable and system property.- Returns:
- prefix of environment variable and system property
-
getEnvironmentVariable
Gets environment variable for the option.- Returns:
- environment variable
-
getSystemProperty
Gets system property for the option.- Returns:
- 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
-