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

io.ultreia.gc.lfn.GeneratedGcLfnConfig Maven / Gradle / Ivy

package io.ultreia.gc.lfn;

import java.io.File;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.function.Supplier;
import javax.annotation.Generated;
import org.nuiton.config.ApplicationConfig;
import org.nuiton.config.ApplicationConfigInit;
import org.nuiton.version.Version;

@Generated(value = "org.nuiton.config.plugin.templates.ApplicationConfigTransformer", date = "Wed Apr 19 12:29:50 UTC 2017")
public abstract class GeneratedGcLfnConfig implements Supplier {

    private ApplicationConfig applicationConfig;

    protected GeneratedGcLfnConfig() {
        this(ApplicationConfigInit.forAllScopes());
    }

    protected GeneratedGcLfnConfig(ApplicationConfigInit init) {
        this.applicationConfig = new ApplicationConfig(init);
        this.applicationConfig.loadDefaultOptions(GcLfnConfigOption.values());
    }

    @Override
    public ApplicationConfig get() {
        return applicationConfig;
    }

    protected void setOption(String key, Object attrName) {
        applicationConfig.setOption(key, String.valueOf(attrName));
    }

    public String getConfigFile() {
        return applicationConfig.getOption(GcLfnConfigOption.CONFIG_FILE.getKey());
    }

    public void setConfigFile(String configFile) {    setOption(GcLfnConfigOption.CONFIG_FILE.getKey(), configFile);
    }

    public String getBuildDate() {
        return applicationConfig.getOption(GcLfnConfigOption.BUILD_DATE.getKey());
    }

    public void setBuildDate(String buildDate) {    setOption(GcLfnConfigOption.BUILD_DATE.getKey(), buildDate);
    }

    public String getBuildNumber() {
        return applicationConfig.getOption(GcLfnConfigOption.BUILD_NUMBER.getKey());
    }

    public void setBuildNumber(String buildNumber) {    setOption(GcLfnConfigOption.BUILD_NUMBER.getKey(), buildNumber);
    }

    public Version getBuildVersion() {
        return applicationConfig.getOptionAsVersion(GcLfnConfigOption.BUILD_VERSION.getKey());
    }

    public void setBuildVersion(Version buildVersion) {    setOption(GcLfnConfigOption.BUILD_VERSION.getKey(), buildVersion);
    }

    public String getLogin() {
        return applicationConfig.getOption(GcLfnConfigOption.LOGIN.getKey());
    }

    public void setLogin(String login) {    setOption(GcLfnConfigOption.LOGIN.getKey(), login);
    }

    public String getPassword() {
        return applicationConfig.getOption(GcLfnConfigOption.PASSWORD.getKey());
    }

    public void setPassword(String password) {    setOption(GcLfnConfigOption.PASSWORD.getKey(), password);
    }

    public boolean isAutoLogin() {
        return applicationConfig.getOptionAsBoolean(GcLfnConfigOption.AUTO_LOGIN.getKey());
    }

    public void setAutoLogin(boolean autoLogin) {    setOption(GcLfnConfigOption.AUTO_LOGIN.getKey(), autoLogin);
    }

    public boolean isAutoVistTrackables() {
        return applicationConfig.getOptionAsBoolean(GcLfnConfigOption.AUTO_VIST_TRACKABLES.getKey());
    }

    public void setAutoVistTrackables(boolean autoVistTrackables) {    setOption(GcLfnConfigOption.AUTO_VIST_TRACKABLES.getKey(), autoVistTrackables);
    }

    public File getLogFile() {
        return applicationConfig.getOptionAsFile(GcLfnConfigOption.LOG_FILE.getKey());
    }

    public void setLogFile(File logFile) {    setOption(GcLfnConfigOption.LOG_FILE.getKey(), logFile);
    }

    public String getConfigurationDescription() {
        StringBuilder builder = new StringBuilder();
        builder.append("\n=====================================================================================================================");
        builder.append("\n=== Configuration ===================================================================================================");
        builder.append("\n=====================================================================================================================");
        builder.append(String.format("\n=== %1$-40s = %2$s", "Filename", get().getConfigFileName()));
        for (GcLfnConfigOption option : orderedByKey()) {
            builder.append(String.format("\n=== %1$-40s = %2$s", option.getKey(), get().getOption(option.getKey())));
        }
        builder.append("\n=====================================================================================================================");
        return builder.toString();
    }

    protected List orderedByKey() {
        List values = Arrays.asList(GcLfnConfigOption.values());
        Collections.sort(values, new Comparator() {
            @Override
            public int compare(GcLfnConfigOption o1, GcLfnConfigOption o2) {
                return o1.getKey().compareTo(o2.getKey());
            }
        });
        return Collections.unmodifiableList(values);
    }

} //GeneratedGcLfnConfig




© 2015 - 2024 Weber Informatics LLC | Privacy Policy