All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.rosetta.jptlegalagreement.model.SimmCalculationCurrency Maven / Gradle / Ivy

There is a newer version: 11.25.1
Show newest version
package com.rosetta.jptlegalagreement.model;

import com.rosetta.jptlegalagreement.model.Party;
import com.rosetta.jptlegalagreement.model.SimmCalculationCurrency;
import com.rosetta.jptlegalagreement.model.SimmCalculationCurrency.SimmCalculationCurrencyBuilder;
import com.rosetta.jptlegalagreement.model.SimmCalculationCurrency.SimmCalculationCurrencyBuilderImpl;
import com.rosetta.jptlegalagreement.model.SimmCalculationCurrency.SimmCalculationCurrencyImpl;
import com.rosetta.jptlegalagreement.model.meta.SimmCalculationCurrencyMeta;
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 com.rosetta.model.metafields.FieldWithMetaString;
import com.rosetta.model.metafields.FieldWithMetaString.FieldWithMetaStringBuilder;
import java.util.Objects;

import static java.util.Optional.ofNullable;

/**
 * @version test
 */
@RosettaDataType(value="SimmCalculationCurrency", builder=SimmCalculationCurrency.SimmCalculationCurrencyBuilderImpl.class, version="test")
public interface SimmCalculationCurrency extends RosettaModelObject {

	SimmCalculationCurrencyMeta metaData = new SimmCalculationCurrencyMeta();

	/*********************** Getter Methods  ***********************/
	ReferenceWithMetaParty getParty();
	Boolean getIsBaseCurrency();
	FieldWithMetaString getCurrency();

	/*********************** Build Methods  ***********************/
	SimmCalculationCurrency build();
	
	SimmCalculationCurrency.SimmCalculationCurrencyBuilder toBuilder();
	
	static SimmCalculationCurrency.SimmCalculationCurrencyBuilder builder() {
		return new SimmCalculationCurrency.SimmCalculationCurrencyBuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return SimmCalculationCurrency.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("party"), processor, ReferenceWithMetaParty.class, getParty());
		processor.processBasic(path.newSubPath("isBaseCurrency"), Boolean.class, getIsBaseCurrency(), this);
		processRosetta(path.newSubPath("currency"), processor, FieldWithMetaString.class, getCurrency());
	}
	

	/*********************** Builder Interface  ***********************/
	interface SimmCalculationCurrencyBuilder extends SimmCalculationCurrency, RosettaModelObjectBuilder {
		ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder getOrCreateParty();
		ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder getParty();
		FieldWithMetaString.FieldWithMetaStringBuilder getOrCreateCurrency();
		FieldWithMetaString.FieldWithMetaStringBuilder getCurrency();
		SimmCalculationCurrency.SimmCalculationCurrencyBuilder setParty(ReferenceWithMetaParty party0);
		SimmCalculationCurrency.SimmCalculationCurrencyBuilder setPartyValue(Party party1);
		SimmCalculationCurrency.SimmCalculationCurrencyBuilder setIsBaseCurrency(Boolean isBaseCurrency);
		SimmCalculationCurrency.SimmCalculationCurrencyBuilder setCurrency(FieldWithMetaString currency0);
		SimmCalculationCurrency.SimmCalculationCurrencyBuilder setCurrencyValue(String currency1);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("party"), processor, ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder.class, getParty());
			processor.processBasic(path.newSubPath("isBaseCurrency"), Boolean.class, getIsBaseCurrency(), this);
			processRosetta(path.newSubPath("currency"), processor, FieldWithMetaString.FieldWithMetaStringBuilder.class, getCurrency());
		}
		

		SimmCalculationCurrency.SimmCalculationCurrencyBuilder prune();
	}

	/*********************** Immutable Implementation of SimmCalculationCurrency  ***********************/
	class SimmCalculationCurrencyImpl implements SimmCalculationCurrency {
		private final ReferenceWithMetaParty party;
		private final Boolean isBaseCurrency;
		private final FieldWithMetaString currency;
		
		protected SimmCalculationCurrencyImpl(SimmCalculationCurrency.SimmCalculationCurrencyBuilder builder) {
			this.party = ofNullable(builder.getParty()).map(f->f.build()).orElse(null);
			this.isBaseCurrency = builder.getIsBaseCurrency();
			this.currency = ofNullable(builder.getCurrency()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("party")
		public ReferenceWithMetaParty getParty() {
			return party;
		}
		
		@Override
		@RosettaAttribute("isBaseCurrency")
		public Boolean getIsBaseCurrency() {
			return isBaseCurrency;
		}
		
		@Override
		@RosettaAttribute("currency")
		public FieldWithMetaString getCurrency() {
			return currency;
		}
		
		@Override
		public SimmCalculationCurrency build() {
			return this;
		}
		
		@Override
		public SimmCalculationCurrency.SimmCalculationCurrencyBuilder toBuilder() {
			SimmCalculationCurrency.SimmCalculationCurrencyBuilder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(SimmCalculationCurrency.SimmCalculationCurrencyBuilder builder) {
			ofNullable(getParty()).ifPresent(builder::setParty);
			ofNullable(getIsBaseCurrency()).ifPresent(builder::setIsBaseCurrency);
			ofNullable(getCurrency()).ifPresent(builder::setCurrency);
		}

		@Override
		public boolean equals(Object o) {
			if (this == o) return true;
			if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
		
			SimmCalculationCurrency _that = getType().cast(o);
		
			if (!Objects.equals(party, _that.getParty())) return false;
			if (!Objects.equals(isBaseCurrency, _that.getIsBaseCurrency())) return false;
			if (!Objects.equals(currency, _that.getCurrency())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (party != null ? party.hashCode() : 0);
			_result = 31 * _result + (isBaseCurrency != null ? isBaseCurrency.hashCode() : 0);
			_result = 31 * _result + (currency != null ? currency.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "SimmCalculationCurrency {" +
				"party=" + this.party + ", " +
				"isBaseCurrency=" + this.isBaseCurrency + ", " +
				"currency=" + this.currency +
			'}';
		}
	}

	/*********************** Builder Implementation of SimmCalculationCurrency  ***********************/
	class SimmCalculationCurrencyBuilderImpl implements SimmCalculationCurrency.SimmCalculationCurrencyBuilder {
	
		protected ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder party;
		protected Boolean isBaseCurrency;
		protected FieldWithMetaString.FieldWithMetaStringBuilder currency;
	
		public SimmCalculationCurrencyBuilderImpl() {
		}
	
		@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("isBaseCurrency")
		public Boolean getIsBaseCurrency() {
			return isBaseCurrency;
		}
		
		@Override
		@RosettaAttribute("currency")
		public FieldWithMetaString.FieldWithMetaStringBuilder getCurrency() {
			return currency;
		}
		
		@Override
		public FieldWithMetaString.FieldWithMetaStringBuilder getOrCreateCurrency() {
			FieldWithMetaString.FieldWithMetaStringBuilder result;
			if (currency!=null) {
				result = currency;
			}
			else {
				result = currency = FieldWithMetaString.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("party")
		public SimmCalculationCurrency.SimmCalculationCurrencyBuilder setParty(ReferenceWithMetaParty party) {
			this.party = party==null?null:party.toBuilder();
			return this;
		}
		@Override
		public SimmCalculationCurrency.SimmCalculationCurrencyBuilder setPartyValue(Party party) {
			this.getOrCreateParty().setValue(party);
			return this;
		}
		@Override
		@RosettaAttribute("isBaseCurrency")
		public SimmCalculationCurrency.SimmCalculationCurrencyBuilder setIsBaseCurrency(Boolean isBaseCurrency) {
			this.isBaseCurrency = isBaseCurrency==null?null:isBaseCurrency;
			return this;
		}
		@Override
		@RosettaAttribute("currency")
		public SimmCalculationCurrency.SimmCalculationCurrencyBuilder setCurrency(FieldWithMetaString currency) {
			this.currency = currency==null?null:currency.toBuilder();
			return this;
		}
		@Override
		public SimmCalculationCurrency.SimmCalculationCurrencyBuilder setCurrencyValue(String currency) {
			this.getOrCreateCurrency().setValue(currency);
			return this;
		}
		
		@Override
		public SimmCalculationCurrency build() {
			return new SimmCalculationCurrency.SimmCalculationCurrencyImpl(this);
		}
		
		@Override
		public SimmCalculationCurrency.SimmCalculationCurrencyBuilder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public SimmCalculationCurrency.SimmCalculationCurrencyBuilder prune() {
			if (party!=null && !party.prune().hasData()) party = null;
			if (currency!=null && !currency.prune().hasData()) currency = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getParty()!=null && getParty().hasData()) return true;
			if (getIsBaseCurrency()!=null) return true;
			if (getCurrency()!=null) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public SimmCalculationCurrency.SimmCalculationCurrencyBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			SimmCalculationCurrency.SimmCalculationCurrencyBuilder o = (SimmCalculationCurrency.SimmCalculationCurrencyBuilder) other;
			
			merger.mergeRosetta(getParty(), o.getParty(), this::setParty);
			merger.mergeRosetta(getCurrency(), o.getCurrency(), this::setCurrency);
			
			merger.mergeBasic(getIsBaseCurrency(), o.getIsBaseCurrency(), this::setIsBaseCurrency);
			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;
		
			SimmCalculationCurrency _that = getType().cast(o);
		
			if (!Objects.equals(party, _that.getParty())) return false;
			if (!Objects.equals(isBaseCurrency, _that.getIsBaseCurrency())) return false;
			if (!Objects.equals(currency, _that.getCurrency())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (party != null ? party.hashCode() : 0);
			_result = 31 * _result + (isBaseCurrency != null ? isBaseCurrency.hashCode() : 0);
			_result = 31 * _result + (currency != null ? currency.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "SimmCalculationCurrencyBuilder {" +
				"party=" + this.party + ", " +
				"isBaseCurrency=" + this.isBaseCurrency + ", " +
				"currency=" + this.currency +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy