Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.rosetta.jptchargorposting.model.PostingObligationsElection Maven / Gradle / Ivy
package com.rosetta.jptchargorposting.model;
import com.google.common.collect.ImmutableList;
import com.rosetta.jptchargorposting.model.EligibleCollateral;
import com.rosetta.jptchargorposting.model.PostingObligationsElection;
import com.rosetta.jptchargorposting.model.PostingObligationsElection.PostingObligationsElectionBuilder;
import com.rosetta.jptchargorposting.model.PostingObligationsElection.PostingObligationsElectionBuilderImpl;
import com.rosetta.jptchargorposting.model.PostingObligationsElection.PostingObligationsElectionImpl;
import com.rosetta.jptchargorposting.model.meta.PostingObligationsElectionMeta;
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 static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="PostingObligationsElection", builder=PostingObligationsElection.PostingObligationsElectionBuilderImpl.class, version="test")
public interface PostingObligationsElection extends RosettaModelObject {
PostingObligationsElectionMeta metaData = new PostingObligationsElectionMeta();
/*********************** Getter Methods ***********************/
String getParty();
List extends EligibleCollateral> getEligibleCollateral();
Boolean getAsPermitted();
String getExcludedCollateral();
String getAdditionalLanguage();
/*********************** Build Methods ***********************/
PostingObligationsElection build();
PostingObligationsElection.PostingObligationsElectionBuilder toBuilder();
static PostingObligationsElection.PostingObligationsElectionBuilder builder() {
return new PostingObligationsElection.PostingObligationsElectionBuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends PostingObligationsElection> metaData() {
return metaData;
}
@Override
default Class extends PostingObligationsElection> getType() {
return PostingObligationsElection.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processor.processBasic(path.newSubPath("party"), String.class, getParty(), this);
processRosetta(path.newSubPath("eligibleCollateral"), processor, EligibleCollateral.class, getEligibleCollateral());
processor.processBasic(path.newSubPath("asPermitted"), Boolean.class, getAsPermitted(), this);
processor.processBasic(path.newSubPath("excludedCollateral"), String.class, getExcludedCollateral(), this);
processor.processBasic(path.newSubPath("additionalLanguage"), String.class, getAdditionalLanguage(), this);
}
/*********************** Builder Interface ***********************/
interface PostingObligationsElectionBuilder extends PostingObligationsElection, RosettaModelObjectBuilder {
EligibleCollateral.EligibleCollateralBuilder getOrCreateEligibleCollateral(int _index);
List extends EligibleCollateral.EligibleCollateralBuilder> getEligibleCollateral();
PostingObligationsElection.PostingObligationsElectionBuilder setParty(String party);
PostingObligationsElection.PostingObligationsElectionBuilder addEligibleCollateral(EligibleCollateral eligibleCollateral0);
PostingObligationsElection.PostingObligationsElectionBuilder addEligibleCollateral(EligibleCollateral eligibleCollateral1, int _idx);
PostingObligationsElection.PostingObligationsElectionBuilder addEligibleCollateral(List extends EligibleCollateral> eligibleCollateral2);
PostingObligationsElection.PostingObligationsElectionBuilder setEligibleCollateral(List extends EligibleCollateral> eligibleCollateral3);
PostingObligationsElection.PostingObligationsElectionBuilder setAsPermitted(Boolean asPermitted);
PostingObligationsElection.PostingObligationsElectionBuilder setExcludedCollateral(String excludedCollateral);
PostingObligationsElection.PostingObligationsElectionBuilder setAdditionalLanguage(String additionalLanguage);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processor.processBasic(path.newSubPath("party"), String.class, getParty(), this);
processRosetta(path.newSubPath("eligibleCollateral"), processor, EligibleCollateral.EligibleCollateralBuilder.class, getEligibleCollateral());
processor.processBasic(path.newSubPath("asPermitted"), Boolean.class, getAsPermitted(), this);
processor.processBasic(path.newSubPath("excludedCollateral"), String.class, getExcludedCollateral(), this);
processor.processBasic(path.newSubPath("additionalLanguage"), String.class, getAdditionalLanguage(), this);
}
PostingObligationsElection.PostingObligationsElectionBuilder prune();
}
/*********************** Immutable Implementation of PostingObligationsElection ***********************/
class PostingObligationsElectionImpl implements PostingObligationsElection {
private final String party;
private final List extends EligibleCollateral> eligibleCollateral;
private final Boolean asPermitted;
private final String excludedCollateral;
private final String additionalLanguage;
protected PostingObligationsElectionImpl(PostingObligationsElection.PostingObligationsElectionBuilder builder) {
this.party = builder.getParty();
this.eligibleCollateral = ofNullable(builder.getEligibleCollateral()).filter(_l->!_l.isEmpty()).map(list -> list.stream().filter(Objects::nonNull).map(f->f.build()).filter(Objects::nonNull).collect(ImmutableList.toImmutableList())).orElse(null);
this.asPermitted = builder.getAsPermitted();
this.excludedCollateral = builder.getExcludedCollateral();
this.additionalLanguage = builder.getAdditionalLanguage();
}
@Override
@RosettaAttribute("party")
public String getParty() {
return party;
}
@Override
@RosettaAttribute("eligibleCollateral")
public List extends EligibleCollateral> getEligibleCollateral() {
return eligibleCollateral;
}
@Override
@RosettaAttribute("asPermitted")
public Boolean getAsPermitted() {
return asPermitted;
}
@Override
@RosettaAttribute("excludedCollateral")
public String getExcludedCollateral() {
return excludedCollateral;
}
@Override
@RosettaAttribute("additionalLanguage")
public String getAdditionalLanguage() {
return additionalLanguage;
}
@Override
public PostingObligationsElection build() {
return this;
}
@Override
public PostingObligationsElection.PostingObligationsElectionBuilder toBuilder() {
PostingObligationsElection.PostingObligationsElectionBuilder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(PostingObligationsElection.PostingObligationsElectionBuilder builder) {
ofNullable(getParty()).ifPresent(builder::setParty);
ofNullable(getEligibleCollateral()).ifPresent(builder::setEligibleCollateral);
ofNullable(getAsPermitted()).ifPresent(builder::setAsPermitted);
ofNullable(getExcludedCollateral()).ifPresent(builder::setExcludedCollateral);
ofNullable(getAdditionalLanguage()).ifPresent(builder::setAdditionalLanguage);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
PostingObligationsElection _that = getType().cast(o);
if (!Objects.equals(party, _that.getParty())) return false;
if (!ListEquals.listEquals(eligibleCollateral, _that.getEligibleCollateral())) return false;
if (!Objects.equals(asPermitted, _that.getAsPermitted())) return false;
if (!Objects.equals(excludedCollateral, _that.getExcludedCollateral())) return false;
if (!Objects.equals(additionalLanguage, _that.getAdditionalLanguage())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (party != null ? party.hashCode() : 0);
_result = 31 * _result + (eligibleCollateral != null ? eligibleCollateral.hashCode() : 0);
_result = 31 * _result + (asPermitted != null ? asPermitted.hashCode() : 0);
_result = 31 * _result + (excludedCollateral != null ? excludedCollateral.hashCode() : 0);
_result = 31 * _result + (additionalLanguage != null ? additionalLanguage.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "PostingObligationsElection {" +
"party=" + this.party + ", " +
"eligibleCollateral=" + this.eligibleCollateral + ", " +
"asPermitted=" + this.asPermitted + ", " +
"excludedCollateral=" + this.excludedCollateral + ", " +
"additionalLanguage=" + this.additionalLanguage +
'}';
}
}
/*********************** Builder Implementation of PostingObligationsElection ***********************/
class PostingObligationsElectionBuilderImpl implements PostingObligationsElection.PostingObligationsElectionBuilder {
protected String party;
protected List eligibleCollateral = new ArrayList<>();
protected Boolean asPermitted;
protected String excludedCollateral;
protected String additionalLanguage;
public PostingObligationsElectionBuilderImpl() {
}
@Override
@RosettaAttribute("party")
public String getParty() {
return party;
}
@Override
@RosettaAttribute("eligibleCollateral")
public List extends EligibleCollateral.EligibleCollateralBuilder> getEligibleCollateral() {
return eligibleCollateral;
}
public EligibleCollateral.EligibleCollateralBuilder getOrCreateEligibleCollateral(int _index) {
if (eligibleCollateral==null) {
this.eligibleCollateral = new ArrayList<>();
}
EligibleCollateral.EligibleCollateralBuilder result;
return getIndex(eligibleCollateral, _index, () -> {
EligibleCollateral.EligibleCollateralBuilder newEligibleCollateral = EligibleCollateral.builder();
return newEligibleCollateral;
});
}
@Override
@RosettaAttribute("asPermitted")
public Boolean getAsPermitted() {
return asPermitted;
}
@Override
@RosettaAttribute("excludedCollateral")
public String getExcludedCollateral() {
return excludedCollateral;
}
@Override
@RosettaAttribute("additionalLanguage")
public String getAdditionalLanguage() {
return additionalLanguage;
}
@Override
@RosettaAttribute("party")
public PostingObligationsElection.PostingObligationsElectionBuilder setParty(String party) {
this.party = party==null?null:party;
return this;
}
@Override
public PostingObligationsElection.PostingObligationsElectionBuilder addEligibleCollateral(EligibleCollateral eligibleCollateral) {
if (eligibleCollateral!=null) this.eligibleCollateral.add(eligibleCollateral.toBuilder());
return this;
}
@Override
public PostingObligationsElection.PostingObligationsElectionBuilder addEligibleCollateral(EligibleCollateral eligibleCollateral, int _idx) {
getIndex(this.eligibleCollateral, _idx, () -> eligibleCollateral.toBuilder());
return this;
}
@Override
public PostingObligationsElection.PostingObligationsElectionBuilder addEligibleCollateral(List extends EligibleCollateral> eligibleCollaterals) {
if (eligibleCollaterals != null) {
for (EligibleCollateral toAdd : eligibleCollaterals) {
this.eligibleCollateral.add(toAdd.toBuilder());
}
}
return this;
}
@Override
@RosettaAttribute("eligibleCollateral")
public PostingObligationsElection.PostingObligationsElectionBuilder setEligibleCollateral(List extends EligibleCollateral> eligibleCollaterals) {
if (eligibleCollaterals == null) {
this.eligibleCollateral = new ArrayList<>();
}
else {
this.eligibleCollateral = eligibleCollaterals.stream()
.map(_a->_a.toBuilder())
.collect(Collectors.toCollection(()->new ArrayList<>()));
}
return this;
}
@Override
@RosettaAttribute("asPermitted")
public PostingObligationsElection.PostingObligationsElectionBuilder setAsPermitted(Boolean asPermitted) {
this.asPermitted = asPermitted==null?null:asPermitted;
return this;
}
@Override
@RosettaAttribute("excludedCollateral")
public PostingObligationsElection.PostingObligationsElectionBuilder setExcludedCollateral(String excludedCollateral) {
this.excludedCollateral = excludedCollateral==null?null:excludedCollateral;
return this;
}
@Override
@RosettaAttribute("additionalLanguage")
public PostingObligationsElection.PostingObligationsElectionBuilder setAdditionalLanguage(String additionalLanguage) {
this.additionalLanguage = additionalLanguage==null?null:additionalLanguage;
return this;
}
@Override
public PostingObligationsElection build() {
return new PostingObligationsElection.PostingObligationsElectionImpl(this);
}
@Override
public PostingObligationsElection.PostingObligationsElectionBuilder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public PostingObligationsElection.PostingObligationsElectionBuilder prune() {
eligibleCollateral = eligibleCollateral.stream().filter(b->b!=null).map(b->b.prune()).filter(b->b.hasData()).collect(Collectors.toList());
return this;
}
@Override
public boolean hasData() {
if (getParty()!=null) return true;
if (getEligibleCollateral()!=null && getEligibleCollateral().stream().filter(Objects::nonNull).anyMatch(a->a.hasData())) return true;
if (getAsPermitted()!=null) return true;
if (getExcludedCollateral()!=null) return true;
if (getAdditionalLanguage()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public PostingObligationsElection.PostingObligationsElectionBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
PostingObligationsElection.PostingObligationsElectionBuilder o = (PostingObligationsElection.PostingObligationsElectionBuilder) other;
merger.mergeRosetta(getEligibleCollateral(), o.getEligibleCollateral(), this::getOrCreateEligibleCollateral);
merger.mergeBasic(getParty(), o.getParty(), this::setParty);
merger.mergeBasic(getAsPermitted(), o.getAsPermitted(), this::setAsPermitted);
merger.mergeBasic(getExcludedCollateral(), o.getExcludedCollateral(), this::setExcludedCollateral);
merger.mergeBasic(getAdditionalLanguage(), o.getAdditionalLanguage(), this::setAdditionalLanguage);
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;
PostingObligationsElection _that = getType().cast(o);
if (!Objects.equals(party, _that.getParty())) return false;
if (!ListEquals.listEquals(eligibleCollateral, _that.getEligibleCollateral())) return false;
if (!Objects.equals(asPermitted, _that.getAsPermitted())) return false;
if (!Objects.equals(excludedCollateral, _that.getExcludedCollateral())) return false;
if (!Objects.equals(additionalLanguage, _that.getAdditionalLanguage())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (party != null ? party.hashCode() : 0);
_result = 31 * _result + (eligibleCollateral != null ? eligibleCollateral.hashCode() : 0);
_result = 31 * _result + (asPermitted != null ? asPermitted.hashCode() : 0);
_result = 31 * _result + (excludedCollateral != null ? excludedCollateral.hashCode() : 0);
_result = 31 * _result + (additionalLanguage != null ? additionalLanguage.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "PostingObligationsElectionBuilder {" +
"party=" + this.party + ", " +
"eligibleCollateral=" + this.eligibleCollateral + ", " +
"asPermitted=" + this.asPermitted + ", " +
"excludedCollateral=" + this.excludedCollateral + ", " +
"additionalLanguage=" + this.additionalLanguage +
'}';
}
}
}