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 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 format
        clazz - 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 as getPrefix() + "_" + 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 as getPrefix() + "_" + 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 as getDefaultValue() 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 as getDefaultValue() 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