org.isda.cdm.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1 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.Objects;
import java.util.stream.Collectors;
import org.isda.cdm.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1;
import org.isda.cdm.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder;
import org.isda.cdm.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1BuilderImpl;
import org.isda.cdm.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Impl;
import org.isda.cdm.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2;
import org.isda.cdm.meta.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Meta;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1", builder=ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1BuilderImpl.class, version="test")
public interface ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1 extends RosettaModelObject {
ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Meta metaData = new ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Meta();
/*********************** Getter Methods ***********************/
List extends ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2> getAttributeWithOneSynonym();
/*********************** Build Methods ***********************/
ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1 build();
ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder toBuilder();
static ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder builder() {
return new ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1> metaData() {
return metaData;
}
@Override
default Class extends ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1> getType() {
return ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processRosetta(path.newSubPath("attributeWithOneSynonym"), processor, ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2.class, getAttributeWithOneSynonym());
}
/*********************** Builder Interface ***********************/
interface ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder extends ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1, RosettaModelObjectBuilder {
ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2Builder getOrCreateAttributeWithOneSynonym(int _index);
List extends ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2Builder> getAttributeWithOneSynonym();
ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder addAttributeWithOneSynonym(ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2 attributeWithOneSynonym0);
ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder addAttributeWithOneSynonym(ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2 attributeWithOneSynonym1, int _idx);
ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder addAttributeWithOneSynonym(List extends ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2> attributeWithOneSynonym2);
ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder setAttributeWithOneSynonym(List extends ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2> attributeWithOneSynonym3);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processRosetta(path.newSubPath("attributeWithOneSynonym"), processor, ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2Builder.class, getAttributeWithOneSynonym());
}
ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder prune();
}
/*********************** Immutable Implementation of ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1 ***********************/
class ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Impl implements ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1 {
private final List extends ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2> attributeWithOneSynonym;
protected ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Impl(ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder builder) {
this.attributeWithOneSynonym = ofNullable(builder.getAttributeWithOneSynonym()).filter(_l->!_l.isEmpty()).map(list -> list.stream().filter(Objects::nonNull).map(f->f.build()).filter(Objects::nonNull).collect(ImmutableList.toImmutableList())).orElse(null);
}
@Override
@RosettaAttribute("attributeWithOneSynonym")
public List extends ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2> getAttributeWithOneSynonym() {
return attributeWithOneSynonym;
}
@Override
public ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1 build() {
return this;
}
@Override
public ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder toBuilder() {
ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder builder) {
ofNullable(getAttributeWithOneSynonym()).ifPresent(builder::setAttributeWithOneSynonym);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1 _that = getType().cast(o);
if (!ListEquals.listEquals(attributeWithOneSynonym, _that.getAttributeWithOneSynonym())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (attributeWithOneSynonym != null ? attributeWithOneSynonym.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1 {" +
"attributeWithOneSynonym=" + this.attributeWithOneSynonym +
'}';
}
}
/*********************** Builder Implementation of ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1 ***********************/
class ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1BuilderImpl implements ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder {
protected List attributeWithOneSynonym = new ArrayList<>();
public ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1BuilderImpl() {
}
@Override
@RosettaAttribute("attributeWithOneSynonym")
public List extends ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2Builder> getAttributeWithOneSynonym() {
return attributeWithOneSynonym;
}
public ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2Builder getOrCreateAttributeWithOneSynonym(int _index) {
if (attributeWithOneSynonym==null) {
this.attributeWithOneSynonym = new ArrayList<>();
}
ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2Builder result;
return getIndex(attributeWithOneSynonym, _index, () -> {
ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2Builder newAttributeWithOneSynonym = ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2.builder();
return newAttributeWithOneSynonym;
});
}
@Override
public ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder addAttributeWithOneSynonym(ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2 attributeWithOneSynonym) {
if (attributeWithOneSynonym!=null) this.attributeWithOneSynonym.add(attributeWithOneSynonym.toBuilder());
return this;
}
@Override
public ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder addAttributeWithOneSynonym(ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2 attributeWithOneSynonym, int _idx) {
getIndex(this.attributeWithOneSynonym, _idx, () -> attributeWithOneSynonym.toBuilder());
return this;
}
@Override
public ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder addAttributeWithOneSynonym(List extends ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2> attributeWithOneSynonyms) {
if (attributeWithOneSynonyms != null) {
for (ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2 toAdd : attributeWithOneSynonyms) {
this.attributeWithOneSynonym.add(toAdd.toBuilder());
}
}
return this;
}
@Override
@RosettaAttribute("attributeWithOneSynonym")
public ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder setAttributeWithOneSynonym(List extends ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_2> attributeWithOneSynonyms) {
if (attributeWithOneSynonyms == null) {
this.attributeWithOneSynonym = new ArrayList<>();
}
else {
this.attributeWithOneSynonym = attributeWithOneSynonyms.stream()
.map(_a->_a.toBuilder())
.collect(Collectors.toCollection(()->new ArrayList<>()));
}
return this;
}
@Override
public ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1 build() {
return new ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Impl(this);
}
@Override
public ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder prune() {
attributeWithOneSynonym = attributeWithOneSynonym.stream().filter(b->b!=null).map(b->b.prune()).filter(b->b.hasData()).collect(Collectors.toList());
return this;
}
@Override
public boolean hasData() {
if (getAttributeWithOneSynonym()!=null && getAttributeWithOneSynonym().stream().filter(Objects::nonNull).anyMatch(a->a.hasData())) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder o = (ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1.ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder) other;
merger.mergeRosetta(getAttributeWithOneSynonym(), o.getAttributeWithOneSynonym(), this::getOrCreateAttributeWithOneSynonym);
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;
ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1 _that = getType().cast(o);
if (!ListEquals.listEquals(attributeWithOneSynonym, _that.getAttributeWithOneSynonym())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (attributeWithOneSynonym != null ? attributeWithOneSynonym.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "ShouldIgnorePathExpressionWhenNextInternalElementHasSynonym_1Builder {" +
"attributeWithOneSynonym=" + this.attributeWithOneSynonym +
'}';
}
}
}