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

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

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

import com.rosetta.jptlegalagreement.model.CollateralRounding;
import com.rosetta.jptlegalagreement.model.CreditSupportObligationsInitialMargin;
import com.rosetta.jptlegalagreement.model.CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginBuilder;
import com.rosetta.jptlegalagreement.model.CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginBuilderImpl;
import com.rosetta.jptlegalagreement.model.CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginImpl;
import com.rosetta.jptlegalagreement.model.MinimumTransferAmount;
import com.rosetta.jptlegalagreement.model.Threshold;
import com.rosetta.jptlegalagreement.model.meta.CreditSupportObligationsInitialMarginMeta;
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.util.Objects;

import static java.util.Optional.ofNullable;

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

	CreditSupportObligationsInitialMarginMeta metaData = new CreditSupportObligationsInitialMarginMeta();

	/*********************** Getter Methods  ***********************/
	Threshold getThreshold();
	MinimumTransferAmount getMinimumTransferAmount();
	CollateralRounding getRounding();

	/*********************** Build Methods  ***********************/
	CreditSupportObligationsInitialMargin build();
	
	CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginBuilder toBuilder();
	
	static CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginBuilder builder() {
		return new CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginBuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return CreditSupportObligationsInitialMargin.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("threshold"), processor, Threshold.class, getThreshold());
		processRosetta(path.newSubPath("minimumTransferAmount"), processor, MinimumTransferAmount.class, getMinimumTransferAmount());
		processRosetta(path.newSubPath("rounding"), processor, CollateralRounding.class, getRounding());
	}
	

	/*********************** Builder Interface  ***********************/
	interface CreditSupportObligationsInitialMarginBuilder extends CreditSupportObligationsInitialMargin, RosettaModelObjectBuilder {
		Threshold.ThresholdBuilder getOrCreateThreshold();
		Threshold.ThresholdBuilder getThreshold();
		MinimumTransferAmount.MinimumTransferAmountBuilder getOrCreateMinimumTransferAmount();
		MinimumTransferAmount.MinimumTransferAmountBuilder getMinimumTransferAmount();
		CollateralRounding.CollateralRoundingBuilder getOrCreateRounding();
		CollateralRounding.CollateralRoundingBuilder getRounding();
		CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginBuilder setThreshold(Threshold threshold);
		CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginBuilder setMinimumTransferAmount(MinimumTransferAmount minimumTransferAmount);
		CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginBuilder setRounding(CollateralRounding rounding);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("threshold"), processor, Threshold.ThresholdBuilder.class, getThreshold());
			processRosetta(path.newSubPath("minimumTransferAmount"), processor, MinimumTransferAmount.MinimumTransferAmountBuilder.class, getMinimumTransferAmount());
			processRosetta(path.newSubPath("rounding"), processor, CollateralRounding.CollateralRoundingBuilder.class, getRounding());
		}
		

		CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginBuilder prune();
	}

	/*********************** Immutable Implementation of CreditSupportObligationsInitialMargin  ***********************/
	class CreditSupportObligationsInitialMarginImpl implements CreditSupportObligationsInitialMargin {
		private final Threshold threshold;
		private final MinimumTransferAmount minimumTransferAmount;
		private final CollateralRounding rounding;
		
		protected CreditSupportObligationsInitialMarginImpl(CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginBuilder builder) {
			this.threshold = ofNullable(builder.getThreshold()).map(f->f.build()).orElse(null);
			this.minimumTransferAmount = ofNullable(builder.getMinimumTransferAmount()).map(f->f.build()).orElse(null);
			this.rounding = ofNullable(builder.getRounding()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("threshold")
		public Threshold getThreshold() {
			return threshold;
		}
		
		@Override
		@RosettaAttribute("minimumTransferAmount")
		public MinimumTransferAmount getMinimumTransferAmount() {
			return minimumTransferAmount;
		}
		
		@Override
		@RosettaAttribute("rounding")
		public CollateralRounding getRounding() {
			return rounding;
		}
		
		@Override
		public CreditSupportObligationsInitialMargin build() {
			return this;
		}
		
		@Override
		public CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginBuilder toBuilder() {
			CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginBuilder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginBuilder builder) {
			ofNullable(getThreshold()).ifPresent(builder::setThreshold);
			ofNullable(getMinimumTransferAmount()).ifPresent(builder::setMinimumTransferAmount);
			ofNullable(getRounding()).ifPresent(builder::setRounding);
		}

		@Override
		public boolean equals(Object o) {
			if (this == o) return true;
			if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
		
			CreditSupportObligationsInitialMargin _that = getType().cast(o);
		
			if (!Objects.equals(threshold, _that.getThreshold())) return false;
			if (!Objects.equals(minimumTransferAmount, _that.getMinimumTransferAmount())) return false;
			if (!Objects.equals(rounding, _that.getRounding())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (threshold != null ? threshold.hashCode() : 0);
			_result = 31 * _result + (minimumTransferAmount != null ? minimumTransferAmount.hashCode() : 0);
			_result = 31 * _result + (rounding != null ? rounding.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "CreditSupportObligationsInitialMargin {" +
				"threshold=" + this.threshold + ", " +
				"minimumTransferAmount=" + this.minimumTransferAmount + ", " +
				"rounding=" + this.rounding +
			'}';
		}
	}

	/*********************** Builder Implementation of CreditSupportObligationsInitialMargin  ***********************/
	class CreditSupportObligationsInitialMarginBuilderImpl implements CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginBuilder {
	
		protected Threshold.ThresholdBuilder threshold;
		protected MinimumTransferAmount.MinimumTransferAmountBuilder minimumTransferAmount;
		protected CollateralRounding.CollateralRoundingBuilder rounding;
	
		public CreditSupportObligationsInitialMarginBuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("threshold")
		public Threshold.ThresholdBuilder getThreshold() {
			return threshold;
		}
		
		@Override
		public Threshold.ThresholdBuilder getOrCreateThreshold() {
			Threshold.ThresholdBuilder result;
			if (threshold!=null) {
				result = threshold;
			}
			else {
				result = threshold = Threshold.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("minimumTransferAmount")
		public MinimumTransferAmount.MinimumTransferAmountBuilder getMinimumTransferAmount() {
			return minimumTransferAmount;
		}
		
		@Override
		public MinimumTransferAmount.MinimumTransferAmountBuilder getOrCreateMinimumTransferAmount() {
			MinimumTransferAmount.MinimumTransferAmountBuilder result;
			if (minimumTransferAmount!=null) {
				result = minimumTransferAmount;
			}
			else {
				result = minimumTransferAmount = MinimumTransferAmount.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("rounding")
		public CollateralRounding.CollateralRoundingBuilder getRounding() {
			return rounding;
		}
		
		@Override
		public CollateralRounding.CollateralRoundingBuilder getOrCreateRounding() {
			CollateralRounding.CollateralRoundingBuilder result;
			if (rounding!=null) {
				result = rounding;
			}
			else {
				result = rounding = CollateralRounding.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("threshold")
		public CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginBuilder setThreshold(Threshold threshold) {
			this.threshold = threshold==null?null:threshold.toBuilder();
			return this;
		}
		@Override
		@RosettaAttribute("minimumTransferAmount")
		public CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginBuilder setMinimumTransferAmount(MinimumTransferAmount minimumTransferAmount) {
			this.minimumTransferAmount = minimumTransferAmount==null?null:minimumTransferAmount.toBuilder();
			return this;
		}
		@Override
		@RosettaAttribute("rounding")
		public CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginBuilder setRounding(CollateralRounding rounding) {
			this.rounding = rounding==null?null:rounding.toBuilder();
			return this;
		}
		
		@Override
		public CreditSupportObligationsInitialMargin build() {
			return new CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginImpl(this);
		}
		
		@Override
		public CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginBuilder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginBuilder prune() {
			if (threshold!=null && !threshold.prune().hasData()) threshold = null;
			if (minimumTransferAmount!=null && !minimumTransferAmount.prune().hasData()) minimumTransferAmount = null;
			if (rounding!=null && !rounding.prune().hasData()) rounding = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getThreshold()!=null && getThreshold().hasData()) return true;
			if (getMinimumTransferAmount()!=null && getMinimumTransferAmount().hasData()) return true;
			if (getRounding()!=null && getRounding().hasData()) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginBuilder o = (CreditSupportObligationsInitialMargin.CreditSupportObligationsInitialMarginBuilder) other;
			
			merger.mergeRosetta(getThreshold(), o.getThreshold(), this::setThreshold);
			merger.mergeRosetta(getMinimumTransferAmount(), o.getMinimumTransferAmount(), this::setMinimumTransferAmount);
			merger.mergeRosetta(getRounding(), o.getRounding(), this::setRounding);
			
			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;
		
			CreditSupportObligationsInitialMargin _that = getType().cast(o);
		
			if (!Objects.equals(threshold, _that.getThreshold())) return false;
			if (!Objects.equals(minimumTransferAmount, _that.getMinimumTransferAmount())) return false;
			if (!Objects.equals(rounding, _that.getRounding())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (threshold != null ? threshold.hashCode() : 0);
			_result = 31 * _result + (minimumTransferAmount != null ? minimumTransferAmount.hashCode() : 0);
			_result = 31 * _result + (rounding != null ? rounding.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "CreditSupportObligationsInitialMarginBuilder {" +
				"threshold=" + this.threshold + ", " +
				"minimumTransferAmount=" + this.minimumTransferAmount + ", " +
				"rounding=" + this.rounding +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy