com.groupdocs.comparison.config.Config.java Source code

Java tutorial

Introduction

Here is the source code for com.groupdocs.comparison.config.Config.java

Source

package com.groupdocs.comparison.config;

import com.bazaarvoice.dropwizard.assets.AssetsBundleConfiguration;
import com.bazaarvoice.dropwizard.assets.AssetsConfiguration;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.yammer.dropwizard.config.Configuration;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.util.Map;

/**
 *
 * @author Alex Bobkov
 */
public class Config extends Configuration implements AssetsBundleConfiguration {
    @Valid
    @NotNull
    @JsonProperty
    private final AssetsConfiguration assets = new AssetsConfiguration();

    @Valid
    @JsonProperty
    private String licensePath;

    @Valid
    @NotNull
    @JsonProperty
    private String applicationPath;

    @Valid
    @NotNull
    @JsonProperty
    private String resultPath;

    @Override
    public AssetsConfiguration getAssetsConfiguration() {
        return assets;
    }

    public String getStoragePath() {
        Iterable<Map.Entry<String, String>> elem = assets.getOverrides();
        String path = elem.iterator().next().getValue();
        if (!path.endsWith("/") && !path.endsWith("\\")) {
            path += "\\";
        }
        return path;
    }

    public String getLicensePath() {
        return licensePath;
    }

    public String getApplicationPath() {
        return applicationPath;
    }

    public String getResultPath() {
        return resultPath;
    }

    public void setResultPath(String resultPath) {
        this.resultPath = resultPath;
    }

}