com.regnosys.rosetta.translate.TranslatorOptionsGroup Maven / Gradle / Ivy
package com.regnosys.rosetta.translate;
import java.util.HashMap;
import java.util.Map;
public class TranslatorOptionsGroup {
private Map options;
private String defaultTranslator;
public Map getOptions() {
return options;
}
public void setOptions(Map options) {
this.options = options;
}
public String getDefaultTranslator() {
return defaultTranslator;
}
public void setDefaultTranslator(String defaultTranslator) {
this.defaultTranslator = defaultTranslator;
}
public TranslatorOptionsGroup mergeGroups(TranslatorOptionsGroup toMerge) {
if (defaultTranslator!=null && toMerge.defaultTranslator!=null && !defaultTranslator.equals(toMerge.defaultTranslator)) {
throw new IllegalArgumentException("Cannot merge two ingestion groups with different defaults");
}
TranslatorOptionsGroup result = new TranslatorOptionsGroup();
result.defaultTranslator = defaultTranslator==null?toMerge.defaultTranslator:defaultTranslator;
Map resultOptions = new HashMap<>(options);
resultOptions.putAll(toMerge.getOptions());
result.setOptions(resultOptions);
return result;
}
}