com.rosetta.metatest.model.PartyTradeIdentifier9 Maven / Gradle / Ivy
package com.rosetta.metatest.model;
import com.google.common.collect.ImmutableList;
import com.rosetta.metatest.model.PartyEnum9;
import com.rosetta.metatest.model.PartyTradeIdentifier9;
import com.rosetta.metatest.model.PartyTradeIdentifier9.PartyTradeIdentifier9Builder;
import com.rosetta.metatest.model.PartyTradeIdentifier9.PartyTradeIdentifier9BuilderImpl;
import com.rosetta.metatest.model.PartyTradeIdentifier9.PartyTradeIdentifier9Impl;
import com.rosetta.metatest.model.meta.PartyTradeIdentifier9Meta;
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 static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="PartyTradeIdentifier9", builder=PartyTradeIdentifier9.PartyTradeIdentifier9BuilderImpl.class, version="test")
public interface PartyTradeIdentifier9 extends RosettaModelObject {
PartyTradeIdentifier9Meta metaData = new PartyTradeIdentifier9Meta();
/*********************** Getter Methods ***********************/
List getPartyEnum();
/*********************** Build Methods ***********************/
PartyTradeIdentifier9 build();
PartyTradeIdentifier9.PartyTradeIdentifier9Builder toBuilder();
static PartyTradeIdentifier9.PartyTradeIdentifier9Builder builder() {
return new PartyTradeIdentifier9.PartyTradeIdentifier9BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends PartyTradeIdentifier9> metaData() {
return metaData;
}
@Override
default Class extends PartyTradeIdentifier9> getType() {
return PartyTradeIdentifier9.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processor.processBasic(path.newSubPath("partyEnum"), PartyEnum9.class, getPartyEnum(), this);
}
/*********************** Builder Interface ***********************/
interface PartyTradeIdentifier9Builder extends PartyTradeIdentifier9, RosettaModelObjectBuilder {
PartyTradeIdentifier9.PartyTradeIdentifier9Builder addPartyEnum(PartyEnum9 partyEnum0);
PartyTradeIdentifier9.PartyTradeIdentifier9Builder addPartyEnum(PartyEnum9 partyEnum1, int _idx);
PartyTradeIdentifier9.PartyTradeIdentifier9Builder addPartyEnum(List partyEnum2);
PartyTradeIdentifier9.PartyTradeIdentifier9Builder setPartyEnum(List partyEnum3);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processor.processBasic(path.newSubPath("partyEnum"), PartyEnum9.class, getPartyEnum(), this);
}
PartyTradeIdentifier9.PartyTradeIdentifier9Builder prune();
}
/*********************** Immutable Implementation of PartyTradeIdentifier9 ***********************/
class PartyTradeIdentifier9Impl implements PartyTradeIdentifier9 {
private final List partyEnum;
protected PartyTradeIdentifier9Impl(PartyTradeIdentifier9.PartyTradeIdentifier9Builder builder) {
this.partyEnum = ofNullable(builder.getPartyEnum()).filter(_l->!_l.isEmpty()).map(ImmutableList::copyOf).orElse(null);
}
@Override
@RosettaAttribute("partyEnum")
public List getPartyEnum() {
return partyEnum;
}
@Override
public PartyTradeIdentifier9 build() {
return this;
}
@Override
public PartyTradeIdentifier9.PartyTradeIdentifier9Builder toBuilder() {
PartyTradeIdentifier9.PartyTradeIdentifier9Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(PartyTradeIdentifier9.PartyTradeIdentifier9Builder builder) {
ofNullable(getPartyEnum()).ifPresent(builder::setPartyEnum);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
PartyTradeIdentifier9 _that = getType().cast(o);
if (!ListEquals.listEquals(partyEnum, _that.getPartyEnum())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (partyEnum != null ? partyEnum.stream().map(Object::getClass).map(Class::getName).mapToInt(String::hashCode).sum() : 0);
return _result;
}
@Override
public String toString() {
return "PartyTradeIdentifier9 {" +
"partyEnum=" + this.partyEnum +
'}';
}
}
/*********************** Builder Implementation of PartyTradeIdentifier9 ***********************/
class PartyTradeIdentifier9BuilderImpl implements PartyTradeIdentifier9.PartyTradeIdentifier9Builder {
protected List partyEnum = new ArrayList<>();
public PartyTradeIdentifier9BuilderImpl() {
}
@Override
@RosettaAttribute("partyEnum")
public List getPartyEnum() {
return partyEnum;
}
@Override
public PartyTradeIdentifier9.PartyTradeIdentifier9Builder addPartyEnum(PartyEnum9 partyEnum) {
if (partyEnum!=null) this.partyEnum.add(partyEnum);
return this;
}
@Override
public PartyTradeIdentifier9.PartyTradeIdentifier9Builder addPartyEnum(PartyEnum9 partyEnum, int _idx) {
getIndex(this.partyEnum, _idx, () -> partyEnum);
return this;
}
@Override
public PartyTradeIdentifier9.PartyTradeIdentifier9Builder addPartyEnum(List partyEnums) {
if (partyEnums != null) {
for (PartyEnum9 toAdd : partyEnums) {
this.partyEnum.add(toAdd);
}
}
return this;
}
@Override
@RosettaAttribute("partyEnum")
public PartyTradeIdentifier9.PartyTradeIdentifier9Builder setPartyEnum(List partyEnums) {
if (partyEnums == null) {
this.partyEnum = new ArrayList<>();
}
else {
this.partyEnum = partyEnums.stream()
.collect(Collectors.toCollection(()->new ArrayList<>()));
}
return this;
}
@Override
public PartyTradeIdentifier9 build() {
return new PartyTradeIdentifier9.PartyTradeIdentifier9Impl(this);
}
@Override
public PartyTradeIdentifier9.PartyTradeIdentifier9Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public PartyTradeIdentifier9.PartyTradeIdentifier9Builder prune() {
return this;
}
@Override
public boolean hasData() {
if (getPartyEnum()!=null && !getPartyEnum().isEmpty()) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public PartyTradeIdentifier9.PartyTradeIdentifier9Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
PartyTradeIdentifier9.PartyTradeIdentifier9Builder o = (PartyTradeIdentifier9.PartyTradeIdentifier9Builder) other;
merger.mergeBasic(getPartyEnum(), o.getPartyEnum(), (Consumer) this::addPartyEnum);
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;
PartyTradeIdentifier9 _that = getType().cast(o);
if (!ListEquals.listEquals(partyEnum, _that.getPartyEnum())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (partyEnum != null ? partyEnum.stream().map(Object::getClass).map(Class::getName).mapToInt(String::hashCode).sum() : 0);
return _result;
}
@Override
public String toString() {
return "PartyTradeIdentifier9Builder {" +
"partyEnum=" + this.partyEnum +
'}';
}
}
}