All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.clickhouse.config.ClickHouseDefaultOption Maven / Gradle / Ivy

There is a newer version: 0.7.1-patch1
Show newest version
package com.clickhouse.config;

import java.io.Serializable;
import java.util.Locale;

import com.clickhouse.data.ClickHouseChecker;

public final class ClickHouseDefaultOption implements ClickHouseOption {
    private final String name;
    private final String key;
    private final Serializable defaultValue;
    private final Class clazz;
    private final boolean sensitive;

    public  ClickHouseDefaultOption(String name, T defaultValue) {
        this(name, defaultValue, false);
    }

    public  ClickHouseDefaultOption(String name, T defaultValue, boolean sensitive) {
        this.name = ClickHouseChecker.nonNull(name, "name").toUpperCase(Locale.ROOT);
        this.key = name.toLowerCase(Locale.ROOT);
        this.defaultValue = ClickHouseChecker.nonNull(defaultValue, "defaultValue");
        this.clazz = defaultValue.getClass();
        this.sensitive = sensitive;
    }

    @Override
    public Serializable getDefaultValue() {
        return defaultValue;
    }

    @Override
    public String getDescription() {
        return "";
    }

    @Override
    public String getKey() {
        return key;
    }

    @Override
    public Class getValueType() {
        return clazz;
    }

    @Override
    public boolean isSensitive() {
        return sensitive;
    }

    @Override
    public String name() {
        return name;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy