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

com.yhzdys.myosotis.MyosotisClient Maven / Gradle / Ivy

There is a newer version: 1.3.4
Show newest version
package com.yhzdys.myosotis;

import java.math.BigDecimal;

public final class MyosotisClient {

    private final String namespace;

    private final MyosotisApplication application;

    MyosotisClient(MyosotisApplication application, String namespace) {
        this.application = application;
        this.namespace = namespace;
    }

    public String getNamespace() {
        return namespace;
    }

    public String getString(String configKey) {
        return application.getConfig(namespace, configKey);
    }

    public  T get(String configKey, Parser parser) {
        String configValue = this.getString(configKey);
        return configValue == null ? null : parser.parse(configValue);
    }

    public Integer getInteger(String configKey) {
        return this.get(configKey, Integer::parseInt);
    }

    public Long getLong(String configKey) {
        return this.get(configKey, Long::parseLong);
    }

    public Float getFloat(String configKey) {
        return this.get(configKey, Float::parseFloat);
    }

    public Double getDouble(String configKey) {
        return this.get(configKey, Double::parseDouble);
    }

    public Boolean getBoolean(String configKey) {
        return this.get(configKey, Boolean::parseBoolean);
    }

    public BigDecimal getBigDecimal(String configKey) {
        return this.get(configKey, BigDecimal::new);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy