org.isda.cdm.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2 Maven / Gradle / Ivy
package org.isda.cdm;
import com.google.common.collect.ImmutableList;
import com.rosetta.model.lib.RosettaModelObject;
import com.rosetta.model.lib.RosettaModelObjectBuilder;
import com.rosetta.model.lib.annotations.RosettaAttribute;
import com.rosetta.model.lib.annotations.RosettaDataType;
import com.rosetta.model.lib.meta.RosettaMetaData;
import com.rosetta.model.lib.path.RosettaPath;
import com.rosetta.model.lib.process.BuilderMerger;
import com.rosetta.model.lib.process.BuilderProcessor;
import com.rosetta.model.lib.process.Processor;
import com.rosetta.util.ListEquals;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import org.isda.cdm.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2;
import org.isda.cdm.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder;
import org.isda.cdm.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2BuilderImpl;
import org.isda.cdm.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Impl;
import org.isda.cdm.meta.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Meta;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2", builder=ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2BuilderImpl.class, version="test")
public interface ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2 extends RosettaModelObject {
ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Meta metaData = new ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Meta();
/*********************** Getter Methods ***********************/
/**
* syn appears in both synonyms and hence 'overlaps'.
*/
List getWithOverlappingSynonyms();
/*********************** Build Methods ***********************/
ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2 build();
ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder toBuilder();
static ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder builder() {
return new ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2> metaData() {
return metaData;
}
@Override
default Class extends ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2> getType() {
return ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processor.processBasic(path.newSubPath("withOverlappingSynonyms"), String.class, getWithOverlappingSynonyms(), this);
}
/*********************** Builder Interface ***********************/
interface ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder extends ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2, RosettaModelObjectBuilder {
ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder addWithOverlappingSynonyms(String withOverlappingSynonyms0);
ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder addWithOverlappingSynonyms(String withOverlappingSynonyms1, int _idx);
ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder addWithOverlappingSynonyms(List withOverlappingSynonyms2);
ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder setWithOverlappingSynonyms(List withOverlappingSynonyms3);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processor.processBasic(path.newSubPath("withOverlappingSynonyms"), String.class, getWithOverlappingSynonyms(), this);
}
ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder prune();
}
/*********************** Immutable Implementation of ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2 ***********************/
class ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Impl implements ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2 {
private final List withOverlappingSynonyms;
protected ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Impl(ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder builder) {
this.withOverlappingSynonyms = ofNullable(builder.getWithOverlappingSynonyms()).filter(_l->!_l.isEmpty()).map(ImmutableList::copyOf).orElse(null);
}
@Override
@RosettaAttribute("withOverlappingSynonyms")
public List getWithOverlappingSynonyms() {
return withOverlappingSynonyms;
}
@Override
public ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2 build() {
return this;
}
@Override
public ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder toBuilder() {
ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder builder) {
ofNullable(getWithOverlappingSynonyms()).ifPresent(builder::setWithOverlappingSynonyms);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2 _that = getType().cast(o);
if (!ListEquals.listEquals(withOverlappingSynonyms, _that.getWithOverlappingSynonyms())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (withOverlappingSynonyms != null ? withOverlappingSynonyms.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2 {" +
"withOverlappingSynonyms=" + this.withOverlappingSynonyms +
'}';
}
}
/*********************** Builder Implementation of ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2 ***********************/
class ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2BuilderImpl implements ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder {
protected List withOverlappingSynonyms = new ArrayList<>();
public ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2BuilderImpl() {
}
@Override
@RosettaAttribute("withOverlappingSynonyms")
public List getWithOverlappingSynonyms() {
return withOverlappingSynonyms;
}
@Override
public ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder addWithOverlappingSynonyms(String withOverlappingSynonyms) {
if (withOverlappingSynonyms!=null) this.withOverlappingSynonyms.add(withOverlappingSynonyms);
return this;
}
@Override
public ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder addWithOverlappingSynonyms(String withOverlappingSynonyms, int _idx) {
getIndex(this.withOverlappingSynonyms, _idx, () -> withOverlappingSynonyms);
return this;
}
@Override
public ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder addWithOverlappingSynonyms(List withOverlappingSynonymss) {
if (withOverlappingSynonymss != null) {
for (String toAdd : withOverlappingSynonymss) {
this.withOverlappingSynonyms.add(toAdd);
}
}
return this;
}
@Override
@RosettaAttribute("withOverlappingSynonyms")
public ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder setWithOverlappingSynonyms(List withOverlappingSynonymss) {
if (withOverlappingSynonymss == null) {
this.withOverlappingSynonyms = new ArrayList<>();
}
else {
this.withOverlappingSynonyms = withOverlappingSynonymss.stream()
.collect(Collectors.toCollection(()->new ArrayList<>()));
}
return this;
}
@Override
public ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2 build() {
return new ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Impl(this);
}
@Override
public ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder prune() {
return this;
}
@Override
public boolean hasData() {
if (getWithOverlappingSynonyms()!=null && !getWithOverlappingSynonyms().isEmpty()) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder o = (ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2.ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder) other;
merger.mergeBasic(getWithOverlappingSynonyms(), o.getWithOverlappingSynonyms(), (Consumer) this::addWithOverlappingSynonyms);
return this;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2 _that = getType().cast(o);
if (!ListEquals.listEquals(withOverlappingSynonyms, _that.getWithOverlappingSynonyms())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (withOverlappingSynonyms != null ? withOverlappingSynonyms.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "ShouldUseLongestSynonymPathWhenMultipleSynonymsMatch_2Builder {" +
"withOverlappingSynonyms=" + this.withOverlappingSynonyms +
'}';
}
}
}