All Downloads are FREE. Search and download functionalities are using the official Maven repository.
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.jptlegalagreement.model.ElectiveAmountElection Maven / Gradle / Ivy
package com.rosetta.jptlegalagreement.model;
import com.rosetta.jptlegalagreement.model.ElectiveAmountElection;
import com.rosetta.jptlegalagreement.model.ElectiveAmountElection.ElectiveAmountElectionBuilder;
import com.rosetta.jptlegalagreement.model.ElectiveAmountElection.ElectiveAmountElectionBuilderImpl;
import com.rosetta.jptlegalagreement.model.ElectiveAmountElection.ElectiveAmountElectionImpl;
import com.rosetta.jptlegalagreement.model.Money;
import com.rosetta.jptlegalagreement.model.Party;
import com.rosetta.jptlegalagreement.model.meta.ElectiveAmountElectionMeta;
import com.rosetta.jptlegalagreement.model.metafields.ReferenceWithMetaParty;
import com.rosetta.jptlegalagreement.model.metafields.ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder;
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 java.math.BigDecimal;
import java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="ElectiveAmountElection", builder=ElectiveAmountElection.ElectiveAmountElectionBuilderImpl.class, version="test")
public interface ElectiveAmountElection extends RosettaModelObject {
ElectiveAmountElectionMeta metaData = new ElectiveAmountElectionMeta();
/*********************** Getter Methods ***********************/
ReferenceWithMetaParty getParty();
Money getAmount();
String getCustomElection();
BigDecimal getNoAmount();
/*********************** Build Methods ***********************/
ElectiveAmountElection build();
ElectiveAmountElection.ElectiveAmountElectionBuilder toBuilder();
static ElectiveAmountElection.ElectiveAmountElectionBuilder builder() {
return new ElectiveAmountElection.ElectiveAmountElectionBuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends ElectiveAmountElection> metaData() {
return metaData;
}
@Override
default Class extends ElectiveAmountElection> getType() {
return ElectiveAmountElection.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processRosetta(path.newSubPath("party"), processor, ReferenceWithMetaParty.class, getParty());
processRosetta(path.newSubPath("amount"), processor, Money.class, getAmount());
processor.processBasic(path.newSubPath("customElection"), String.class, getCustomElection(), this);
processor.processBasic(path.newSubPath("noAmount"), BigDecimal.class, getNoAmount(), this);
}
/*********************** Builder Interface ***********************/
interface ElectiveAmountElectionBuilder extends ElectiveAmountElection, RosettaModelObjectBuilder {
ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder getOrCreateParty();
ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder getParty();
Money.MoneyBuilder getOrCreateAmount();
Money.MoneyBuilder getAmount();
ElectiveAmountElection.ElectiveAmountElectionBuilder setParty(ReferenceWithMetaParty party0);
ElectiveAmountElection.ElectiveAmountElectionBuilder setPartyValue(Party party1);
ElectiveAmountElection.ElectiveAmountElectionBuilder setAmount(Money amount);
ElectiveAmountElection.ElectiveAmountElectionBuilder setCustomElection(String customElection);
ElectiveAmountElection.ElectiveAmountElectionBuilder setNoAmount(BigDecimal noAmount);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processRosetta(path.newSubPath("party"), processor, ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder.class, getParty());
processRosetta(path.newSubPath("amount"), processor, Money.MoneyBuilder.class, getAmount());
processor.processBasic(path.newSubPath("customElection"), String.class, getCustomElection(), this);
processor.processBasic(path.newSubPath("noAmount"), BigDecimal.class, getNoAmount(), this);
}
ElectiveAmountElection.ElectiveAmountElectionBuilder prune();
}
/*********************** Immutable Implementation of ElectiveAmountElection ***********************/
class ElectiveAmountElectionImpl implements ElectiveAmountElection {
private final ReferenceWithMetaParty party;
private final Money amount;
private final String customElection;
private final BigDecimal noAmount;
protected ElectiveAmountElectionImpl(ElectiveAmountElection.ElectiveAmountElectionBuilder builder) {
this.party = ofNullable(builder.getParty()).map(f->f.build()).orElse(null);
this.amount = ofNullable(builder.getAmount()).map(f->f.build()).orElse(null);
this.customElection = builder.getCustomElection();
this.noAmount = builder.getNoAmount();
}
@Override
@RosettaAttribute("party")
public ReferenceWithMetaParty getParty() {
return party;
}
@Override
@RosettaAttribute("amount")
public Money getAmount() {
return amount;
}
@Override
@RosettaAttribute("customElection")
public String getCustomElection() {
return customElection;
}
@Override
@RosettaAttribute("noAmount")
public BigDecimal getNoAmount() {
return noAmount;
}
@Override
public ElectiveAmountElection build() {
return this;
}
@Override
public ElectiveAmountElection.ElectiveAmountElectionBuilder toBuilder() {
ElectiveAmountElection.ElectiveAmountElectionBuilder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(ElectiveAmountElection.ElectiveAmountElectionBuilder builder) {
ofNullable(getParty()).ifPresent(builder::setParty);
ofNullable(getAmount()).ifPresent(builder::setAmount);
ofNullable(getCustomElection()).ifPresent(builder::setCustomElection);
ofNullable(getNoAmount()).ifPresent(builder::setNoAmount);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
ElectiveAmountElection _that = getType().cast(o);
if (!Objects.equals(party, _that.getParty())) return false;
if (!Objects.equals(amount, _that.getAmount())) return false;
if (!Objects.equals(customElection, _that.getCustomElection())) return false;
if (!Objects.equals(noAmount, _that.getNoAmount())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (party != null ? party.hashCode() : 0);
_result = 31 * _result + (amount != null ? amount.hashCode() : 0);
_result = 31 * _result + (customElection != null ? customElection.hashCode() : 0);
_result = 31 * _result + (noAmount != null ? noAmount.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "ElectiveAmountElection {" +
"party=" + this.party + ", " +
"amount=" + this.amount + ", " +
"customElection=" + this.customElection + ", " +
"noAmount=" + this.noAmount +
'}';
}
}
/*********************** Builder Implementation of ElectiveAmountElection ***********************/
class ElectiveAmountElectionBuilderImpl implements ElectiveAmountElection.ElectiveAmountElectionBuilder {
protected ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder party;
protected Money.MoneyBuilder amount;
protected String customElection;
protected BigDecimal noAmount;
public ElectiveAmountElectionBuilderImpl() {
}
@Override
@RosettaAttribute("party")
public ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder getParty() {
return party;
}
@Override
public ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder getOrCreateParty() {
ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder result;
if (party!=null) {
result = party;
}
else {
result = party = ReferenceWithMetaParty.builder();
}
return result;
}
@Override
@RosettaAttribute("amount")
public Money.MoneyBuilder getAmount() {
return amount;
}
@Override
public Money.MoneyBuilder getOrCreateAmount() {
Money.MoneyBuilder result;
if (amount!=null) {
result = amount;
}
else {
result = amount = Money.builder();
}
return result;
}
@Override
@RosettaAttribute("customElection")
public String getCustomElection() {
return customElection;
}
@Override
@RosettaAttribute("noAmount")
public BigDecimal getNoAmount() {
return noAmount;
}
@Override
@RosettaAttribute("party")
public ElectiveAmountElection.ElectiveAmountElectionBuilder setParty(ReferenceWithMetaParty party) {
this.party = party==null?null:party.toBuilder();
return this;
}
@Override
public ElectiveAmountElection.ElectiveAmountElectionBuilder setPartyValue(Party party) {
this.getOrCreateParty().setValue(party);
return this;
}
@Override
@RosettaAttribute("amount")
public ElectiveAmountElection.ElectiveAmountElectionBuilder setAmount(Money amount) {
this.amount = amount==null?null:amount.toBuilder();
return this;
}
@Override
@RosettaAttribute("customElection")
public ElectiveAmountElection.ElectiveAmountElectionBuilder setCustomElection(String customElection) {
this.customElection = customElection==null?null:customElection;
return this;
}
@Override
@RosettaAttribute("noAmount")
public ElectiveAmountElection.ElectiveAmountElectionBuilder setNoAmount(BigDecimal noAmount) {
this.noAmount = noAmount==null?null:noAmount;
return this;
}
@Override
public ElectiveAmountElection build() {
return new ElectiveAmountElection.ElectiveAmountElectionImpl(this);
}
@Override
public ElectiveAmountElection.ElectiveAmountElectionBuilder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public ElectiveAmountElection.ElectiveAmountElectionBuilder prune() {
if (party!=null && !party.prune().hasData()) party = null;
if (amount!=null && !amount.prune().hasData()) amount = null;
return this;
}
@Override
public boolean hasData() {
if (getParty()!=null && getParty().hasData()) return true;
if (getAmount()!=null && getAmount().hasData()) return true;
if (getCustomElection()!=null) return true;
if (getNoAmount()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public ElectiveAmountElection.ElectiveAmountElectionBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
ElectiveAmountElection.ElectiveAmountElectionBuilder o = (ElectiveAmountElection.ElectiveAmountElectionBuilder) other;
merger.mergeRosetta(getParty(), o.getParty(), this::setParty);
merger.mergeRosetta(getAmount(), o.getAmount(), this::setAmount);
merger.mergeBasic(getCustomElection(), o.getCustomElection(), this::setCustomElection);
merger.mergeBasic(getNoAmount(), o.getNoAmount(), this::setNoAmount);
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;
ElectiveAmountElection _that = getType().cast(o);
if (!Objects.equals(party, _that.getParty())) return false;
if (!Objects.equals(amount, _that.getAmount())) return false;
if (!Objects.equals(customElection, _that.getCustomElection())) return false;
if (!Objects.equals(noAmount, _that.getNoAmount())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (party != null ? party.hashCode() : 0);
_result = 31 * _result + (amount != null ? amount.hashCode() : 0);
_result = 31 * _result + (customElection != null ? customElection.hashCode() : 0);
_result = 31 * _result + (noAmount != null ? noAmount.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "ElectiveAmountElectionBuilder {" +
"party=" + this.party + ", " +
"amount=" + this.amount + ", " +
"customElection=" + this.customElection + ", " +
"noAmount=" + this.noAmount +
'}';
}
}
}