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

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

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

import com.rosetta.jptlegalagreement.model.AmendmentEffectiveDate;
import com.rosetta.jptlegalagreement.model.PartyTerminationCurrency;
import com.rosetta.jptlegalagreement.model.TerminationCurrencyAmendment;
import com.rosetta.jptlegalagreement.model.TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder;
import com.rosetta.jptlegalagreement.model.TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilderImpl;
import com.rosetta.jptlegalagreement.model.TerminationCurrencyAmendment.TerminationCurrencyAmendmentImpl;
import com.rosetta.jptlegalagreement.model.meta.TerminationCurrencyAmendmentMeta;
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="TerminationCurrencyAmendment", builder=TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilderImpl.class, version="test")
public interface TerminationCurrencyAmendment extends RosettaModelObject {

	TerminationCurrencyAmendmentMeta metaData = new TerminationCurrencyAmendmentMeta();

	/*********************** Getter Methods  ***********************/
	Boolean getIsApplicable();
	AmendmentEffectiveDate getEffectiveDate();
	PartyTerminationCurrency getTerminationCurrency();
	FieldWithMetaString getBothPartiesCurrency();

	/*********************** Build Methods  ***********************/
	TerminationCurrencyAmendment build();
	
	TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder toBuilder();
	
	static TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder builder() {
		return new TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return TerminationCurrencyAmendment.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processor.processBasic(path.newSubPath("isApplicable"), Boolean.class, getIsApplicable(), this);
		processRosetta(path.newSubPath("effectiveDate"), processor, AmendmentEffectiveDate.class, getEffectiveDate());
		processRosetta(path.newSubPath("terminationCurrency"), processor, PartyTerminationCurrency.class, getTerminationCurrency());
		processRosetta(path.newSubPath("bothPartiesCurrency"), processor, FieldWithMetaString.class, getBothPartiesCurrency());
	}
	

	/*********************** Builder Interface  ***********************/
	interface TerminationCurrencyAmendmentBuilder extends TerminationCurrencyAmendment, RosettaModelObjectBuilder {
		AmendmentEffectiveDate.AmendmentEffectiveDateBuilder getOrCreateEffectiveDate();
		AmendmentEffectiveDate.AmendmentEffectiveDateBuilder getEffectiveDate();
		PartyTerminationCurrency.PartyTerminationCurrencyBuilder getOrCreateTerminationCurrency();
		PartyTerminationCurrency.PartyTerminationCurrencyBuilder getTerminationCurrency();
		FieldWithMetaString.FieldWithMetaStringBuilder getOrCreateBothPartiesCurrency();
		FieldWithMetaString.FieldWithMetaStringBuilder getBothPartiesCurrency();
		TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder setIsApplicable(Boolean isApplicable);
		TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder setEffectiveDate(AmendmentEffectiveDate effectiveDate);
		TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder setTerminationCurrency(PartyTerminationCurrency terminationCurrency);
		TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder setBothPartiesCurrency(FieldWithMetaString bothPartiesCurrency0);
		TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder setBothPartiesCurrencyValue(String bothPartiesCurrency1);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processor.processBasic(path.newSubPath("isApplicable"), Boolean.class, getIsApplicable(), this);
			processRosetta(path.newSubPath("effectiveDate"), processor, AmendmentEffectiveDate.AmendmentEffectiveDateBuilder.class, getEffectiveDate());
			processRosetta(path.newSubPath("terminationCurrency"), processor, PartyTerminationCurrency.PartyTerminationCurrencyBuilder.class, getTerminationCurrency());
			processRosetta(path.newSubPath("bothPartiesCurrency"), processor, FieldWithMetaString.FieldWithMetaStringBuilder.class, getBothPartiesCurrency());
		}
		

		TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder prune();
	}

	/*********************** Immutable Implementation of TerminationCurrencyAmendment  ***********************/
	class TerminationCurrencyAmendmentImpl implements TerminationCurrencyAmendment {
		private final Boolean isApplicable;
		private final AmendmentEffectiveDate effectiveDate;
		private final PartyTerminationCurrency terminationCurrency;
		private final FieldWithMetaString bothPartiesCurrency;
		
		protected TerminationCurrencyAmendmentImpl(TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder builder) {
			this.isApplicable = builder.getIsApplicable();
			this.effectiveDate = ofNullable(builder.getEffectiveDate()).map(f->f.build()).orElse(null);
			this.terminationCurrency = ofNullable(builder.getTerminationCurrency()).map(f->f.build()).orElse(null);
			this.bothPartiesCurrency = ofNullable(builder.getBothPartiesCurrency()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("isApplicable")
		public Boolean getIsApplicable() {
			return isApplicable;
		}
		
		@Override
		@RosettaAttribute("effectiveDate")
		public AmendmentEffectiveDate getEffectiveDate() {
			return effectiveDate;
		}
		
		@Override
		@RosettaAttribute("terminationCurrency")
		public PartyTerminationCurrency getTerminationCurrency() {
			return terminationCurrency;
		}
		
		@Override
		@RosettaAttribute("bothPartiesCurrency")
		public FieldWithMetaString getBothPartiesCurrency() {
			return bothPartiesCurrency;
		}
		
		@Override
		public TerminationCurrencyAmendment build() {
			return this;
		}
		
		@Override
		public TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder toBuilder() {
			TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder builder) {
			ofNullable(getIsApplicable()).ifPresent(builder::setIsApplicable);
			ofNullable(getEffectiveDate()).ifPresent(builder::setEffectiveDate);
			ofNullable(getTerminationCurrency()).ifPresent(builder::setTerminationCurrency);
			ofNullable(getBothPartiesCurrency()).ifPresent(builder::setBothPartiesCurrency);
		}

		@Override
		public boolean equals(Object o) {
			if (this == o) return true;
			if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
		
			TerminationCurrencyAmendment _that = getType().cast(o);
		
			if (!Objects.equals(isApplicable, _that.getIsApplicable())) return false;
			if (!Objects.equals(effectiveDate, _that.getEffectiveDate())) return false;
			if (!Objects.equals(terminationCurrency, _that.getTerminationCurrency())) return false;
			if (!Objects.equals(bothPartiesCurrency, _that.getBothPartiesCurrency())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (isApplicable != null ? isApplicable.hashCode() : 0);
			_result = 31 * _result + (effectiveDate != null ? effectiveDate.hashCode() : 0);
			_result = 31 * _result + (terminationCurrency != null ? terminationCurrency.hashCode() : 0);
			_result = 31 * _result + (bothPartiesCurrency != null ? bothPartiesCurrency.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "TerminationCurrencyAmendment {" +
				"isApplicable=" + this.isApplicable + ", " +
				"effectiveDate=" + this.effectiveDate + ", " +
				"terminationCurrency=" + this.terminationCurrency + ", " +
				"bothPartiesCurrency=" + this.bothPartiesCurrency +
			'}';
		}
	}

	/*********************** Builder Implementation of TerminationCurrencyAmendment  ***********************/
	class TerminationCurrencyAmendmentBuilderImpl implements TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder {
	
		protected Boolean isApplicable;
		protected AmendmentEffectiveDate.AmendmentEffectiveDateBuilder effectiveDate;
		protected PartyTerminationCurrency.PartyTerminationCurrencyBuilder terminationCurrency;
		protected FieldWithMetaString.FieldWithMetaStringBuilder bothPartiesCurrency;
	
		public TerminationCurrencyAmendmentBuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("isApplicable")
		public Boolean getIsApplicable() {
			return isApplicable;
		}
		
		@Override
		@RosettaAttribute("effectiveDate")
		public AmendmentEffectiveDate.AmendmentEffectiveDateBuilder getEffectiveDate() {
			return effectiveDate;
		}
		
		@Override
		public AmendmentEffectiveDate.AmendmentEffectiveDateBuilder getOrCreateEffectiveDate() {
			AmendmentEffectiveDate.AmendmentEffectiveDateBuilder result;
			if (effectiveDate!=null) {
				result = effectiveDate;
			}
			else {
				result = effectiveDate = AmendmentEffectiveDate.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("terminationCurrency")
		public PartyTerminationCurrency.PartyTerminationCurrencyBuilder getTerminationCurrency() {
			return terminationCurrency;
		}
		
		@Override
		public PartyTerminationCurrency.PartyTerminationCurrencyBuilder getOrCreateTerminationCurrency() {
			PartyTerminationCurrency.PartyTerminationCurrencyBuilder result;
			if (terminationCurrency!=null) {
				result = terminationCurrency;
			}
			else {
				result = terminationCurrency = PartyTerminationCurrency.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("bothPartiesCurrency")
		public FieldWithMetaString.FieldWithMetaStringBuilder getBothPartiesCurrency() {
			return bothPartiesCurrency;
		}
		
		@Override
		public FieldWithMetaString.FieldWithMetaStringBuilder getOrCreateBothPartiesCurrency() {
			FieldWithMetaString.FieldWithMetaStringBuilder result;
			if (bothPartiesCurrency!=null) {
				result = bothPartiesCurrency;
			}
			else {
				result = bothPartiesCurrency = FieldWithMetaString.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("isApplicable")
		public TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder setIsApplicable(Boolean isApplicable) {
			this.isApplicable = isApplicable==null?null:isApplicable;
			return this;
		}
		@Override
		@RosettaAttribute("effectiveDate")
		public TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder setEffectiveDate(AmendmentEffectiveDate effectiveDate) {
			this.effectiveDate = effectiveDate==null?null:effectiveDate.toBuilder();
			return this;
		}
		@Override
		@RosettaAttribute("terminationCurrency")
		public TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder setTerminationCurrency(PartyTerminationCurrency terminationCurrency) {
			this.terminationCurrency = terminationCurrency==null?null:terminationCurrency.toBuilder();
			return this;
		}
		@Override
		@RosettaAttribute("bothPartiesCurrency")
		public TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder setBothPartiesCurrency(FieldWithMetaString bothPartiesCurrency) {
			this.bothPartiesCurrency = bothPartiesCurrency==null?null:bothPartiesCurrency.toBuilder();
			return this;
		}
		@Override
		public TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder setBothPartiesCurrencyValue(String bothPartiesCurrency) {
			this.getOrCreateBothPartiesCurrency().setValue(bothPartiesCurrency);
			return this;
		}
		
		@Override
		public TerminationCurrencyAmendment build() {
			return new TerminationCurrencyAmendment.TerminationCurrencyAmendmentImpl(this);
		}
		
		@Override
		public TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder prune() {
			if (effectiveDate!=null && !effectiveDate.prune().hasData()) effectiveDate = null;
			if (terminationCurrency!=null && !terminationCurrency.prune().hasData()) terminationCurrency = null;
			if (bothPartiesCurrency!=null && !bothPartiesCurrency.prune().hasData()) bothPartiesCurrency = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getIsApplicable()!=null) return true;
			if (getEffectiveDate()!=null && getEffectiveDate().hasData()) return true;
			if (getTerminationCurrency()!=null && getTerminationCurrency().hasData()) return true;
			if (getBothPartiesCurrency()!=null) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder o = (TerminationCurrencyAmendment.TerminationCurrencyAmendmentBuilder) other;
			
			merger.mergeRosetta(getEffectiveDate(), o.getEffectiveDate(), this::setEffectiveDate);
			merger.mergeRosetta(getTerminationCurrency(), o.getTerminationCurrency(), this::setTerminationCurrency);
			merger.mergeRosetta(getBothPartiesCurrency(), o.getBothPartiesCurrency(), this::setBothPartiesCurrency);
			
			merger.mergeBasic(getIsApplicable(), o.getIsApplicable(), this::setIsApplicable);
			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;
		
			TerminationCurrencyAmendment _that = getType().cast(o);
		
			if (!Objects.equals(isApplicable, _that.getIsApplicable())) return false;
			if (!Objects.equals(effectiveDate, _that.getEffectiveDate())) return false;
			if (!Objects.equals(terminationCurrency, _that.getTerminationCurrency())) return false;
			if (!Objects.equals(bothPartiesCurrency, _that.getBothPartiesCurrency())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (isApplicable != null ? isApplicable.hashCode() : 0);
			_result = 31 * _result + (effectiveDate != null ? effectiveDate.hashCode() : 0);
			_result = 31 * _result + (terminationCurrency != null ? terminationCurrency.hashCode() : 0);
			_result = 31 * _result + (bothPartiesCurrency != null ? bothPartiesCurrency.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "TerminationCurrencyAmendmentBuilder {" +
				"isApplicable=" + this.isApplicable + ", " +
				"effectiveDate=" + this.effectiveDate + ", " +
				"terminationCurrency=" + this.terminationCurrency + ", " +
				"bothPartiesCurrency=" + this.bothPartiesCurrency +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy