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

com.regnosys.rosetta.translate.TranslatorOptionsBuilder Maven / Gradle / Ivy

There is a newer version: 11.25.1
Show newest version
package com.regnosys.rosetta.translate;

import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;

import java.util.*;
import java.util.stream.Collectors;

@Deprecated //- json files in the models are now the source of this data
public class TranslatorOptionsBuilder {

    private String name;
    private Optional modelId;
    private Collection modelClasspath = new ArrayList<>();
    private String modelFileDirIncludeRegex;
    private Optional modelFileDirExcludeRegex = Optional.empty();
    private Collection rosettaClasses = new ArrayList<>();
    private String generatedPackage;
    private String generatedFactoryName;
    private Map xsdFilePaths = new HashMap<>();
    private Multimap synonymSources = ArrayListMultimap.create();
    private Multimap topLevelTags = ArrayListMultimap.create();
    private Map childPackageNames = new HashMap<>();
    private boolean verbose = false;
    private boolean clean = false;
    private boolean json = false;
    private String xmlExclusionsFilePath;
    private String cdmClassesDir = "";
    private Multimap integrationTestRoots = ArrayListMultimap.create();

    public static TranslatorOptionsBuilder newBuilder() {
        return new TranslatorOptionsBuilder();
    }

    public TranslatorOptionsBuilder withName(String name) {
        this.name = name;
        return this;
    }

    public TranslatorOptionsBuilder withModelId(String modelId) {
        this.modelId = Optional.of(modelId);
        return this;
    }

    public TranslatorOptionsBuilder withModelClasspath(String... modelClasspath) {
        this.modelClasspath.addAll(Arrays.asList(modelClasspath));
        return this;
    }

    public TranslatorOptionsBuilder withModelFileDirIncludeRegex(String modelFileDirIncludeRegex) {
        this.modelFileDirIncludeRegex = modelFileDirIncludeRegex;
        return this;
    }

    public TranslatorOptionsBuilder withModelFileDirExcludeRegex(String modelFileDirExcludeRegex) {
        this.modelFileDirExcludeRegex = Optional.of(modelFileDirExcludeRegex);
        return this;
    }

    public TranslatorOptionsBuilder withRosettaClass(String rosettaClass) {
        this.rosettaClasses.addAll(Arrays.asList(rosettaClass));
        return this;
    }

    public TranslatorOptionsBuilder withGeneratedPackage(String generatedPackage) {
        this.generatedPackage = generatedPackage;
        return this;
    }

    public TranslatorOptionsBuilder withGeneratedFactoryName(String generatedFactoryName) {
        this.generatedFactoryName = generatedFactoryName;
        return this;
    }

    public TranslatorOptionsBuilder withXsdFilePath(String rosettaClass, String xsdFilePath) {
        this.xsdFilePaths.put(rosettaClass, xsdFilePath);
        return this;
    }

    public TranslatorOptionsBuilder withSynonymSources(String rosettaClass, String... synonymSources) {
        for (String synonymSource : synonymSources) {
            this.synonymSources.put(rosettaClass, synonymSource);
        }
        return this;
    }

    public TranslatorOptionsBuilder withTopLevelTags(String rosettaClass, String... topLevelTags) {
        for (String topLevelTag : topLevelTags) {
            this.topLevelTags.put(rosettaClass, topLevelTag);
        }
        return this;
    }

    public TranslatorOptionsBuilder withChildPackageNames(String rosettaClass, String childPackageName) {
        this.childPackageNames.put(rosettaClass, childPackageName);
        return this;
    }

    public TranslatorOptionsBuilder withVerboseCompiler(String verbose) {
        this.verbose = Boolean.valueOf(verbose);
        return this;
    }

    public TranslatorOptionsBuilder withClean(boolean clean) {
        this.clean = clean;
        return this;
    }

    public TranslatorOptionsBuilder withJson(boolean json) {
        this.json = json;
        return this;
    }

    public TranslatorOptionsBuilder withXmlExclusionsFilePath(String xmlExclusionsFilePath) {
        this.xmlExclusionsFilePath = xmlExclusionsFilePath;
        return this;
    }

    public TranslatorOptionsBuilder withCdmClassesDir(String cdmClassesDir) {
        this.cdmClassesDir = cdmClassesDir;
        return this;
    }

    public TranslatorOptionsBuilder withIntegrationTestRoot(String rosettaClass, String integrationTestRoot) {
        this.integrationTestRoots.put(rosettaClass, integrationTestRoot);
        return this;
    }

    public TranslatorOptions build() {
        return new TranslatorOptionsImpl(name, modelId, modelClasspath, modelFileDirIncludeRegex,
                modelFileDirExcludeRegex, rosettaClasses, generatedPackage, generatedFactoryName,
                xsdFilePaths, synonymSources, topLevelTags, childPackageNames, verbose, clean, json, false, xmlExclusionsFilePath, cdmClassesDir,
                integrationTestRoots, false, rosettaClasses.stream().collect(Collectors.toMap(c -> c, c -> generatedPackage)), false);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy