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

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

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

import com.rosetta.jptlegalagreement.model.FxHaircutCurrency;
import com.rosetta.jptlegalagreement.model.FxHaircutCurrency.FxHaircutCurrencyBuilder;
import com.rosetta.jptlegalagreement.model.FxHaircutCurrency.FxHaircutCurrencyBuilderImpl;
import com.rosetta.jptlegalagreement.model.FxHaircutCurrency.FxHaircutCurrencyImpl;
import com.rosetta.jptlegalagreement.model.meta.FxHaircutCurrencyMeta;
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="FxHaircutCurrency", builder=FxHaircutCurrency.FxHaircutCurrencyBuilderImpl.class, version="test")
public interface FxHaircutCurrency extends RosettaModelObject {

	FxHaircutCurrencyMeta metaData = new FxHaircutCurrencyMeta();

	/*********************** Getter Methods  ***********************/
	Boolean getIsTerminationCurrency();
	FieldWithMetaString getFxDesignatedCurrency();

	/*********************** Build Methods  ***********************/
	FxHaircutCurrency build();
	
	FxHaircutCurrency.FxHaircutCurrencyBuilder toBuilder();
	
	static FxHaircutCurrency.FxHaircutCurrencyBuilder builder() {
		return new FxHaircutCurrency.FxHaircutCurrencyBuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return FxHaircutCurrency.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processor.processBasic(path.newSubPath("isTerminationCurrency"), Boolean.class, getIsTerminationCurrency(), this);
		processRosetta(path.newSubPath("fxDesignatedCurrency"), processor, FieldWithMetaString.class, getFxDesignatedCurrency());
	}
	

	/*********************** Builder Interface  ***********************/
	interface FxHaircutCurrencyBuilder extends FxHaircutCurrency, RosettaModelObjectBuilder {
		FieldWithMetaString.FieldWithMetaStringBuilder getOrCreateFxDesignatedCurrency();
		FieldWithMetaString.FieldWithMetaStringBuilder getFxDesignatedCurrency();
		FxHaircutCurrency.FxHaircutCurrencyBuilder setIsTerminationCurrency(Boolean isTerminationCurrency);
		FxHaircutCurrency.FxHaircutCurrencyBuilder setFxDesignatedCurrency(FieldWithMetaString fxDesignatedCurrency0);
		FxHaircutCurrency.FxHaircutCurrencyBuilder setFxDesignatedCurrencyValue(String fxDesignatedCurrency1);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processor.processBasic(path.newSubPath("isTerminationCurrency"), Boolean.class, getIsTerminationCurrency(), this);
			processRosetta(path.newSubPath("fxDesignatedCurrency"), processor, FieldWithMetaString.FieldWithMetaStringBuilder.class, getFxDesignatedCurrency());
		}
		

		FxHaircutCurrency.FxHaircutCurrencyBuilder prune();
	}

	/*********************** Immutable Implementation of FxHaircutCurrency  ***********************/
	class FxHaircutCurrencyImpl implements FxHaircutCurrency {
		private final Boolean isTerminationCurrency;
		private final FieldWithMetaString fxDesignatedCurrency;
		
		protected FxHaircutCurrencyImpl(FxHaircutCurrency.FxHaircutCurrencyBuilder builder) {
			this.isTerminationCurrency = builder.getIsTerminationCurrency();
			this.fxDesignatedCurrency = ofNullable(builder.getFxDesignatedCurrency()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("isTerminationCurrency")
		public Boolean getIsTerminationCurrency() {
			return isTerminationCurrency;
		}
		
		@Override
		@RosettaAttribute("fxDesignatedCurrency")
		public FieldWithMetaString getFxDesignatedCurrency() {
			return fxDesignatedCurrency;
		}
		
		@Override
		public FxHaircutCurrency build() {
			return this;
		}
		
		@Override
		public FxHaircutCurrency.FxHaircutCurrencyBuilder toBuilder() {
			FxHaircutCurrency.FxHaircutCurrencyBuilder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(FxHaircutCurrency.FxHaircutCurrencyBuilder builder) {
			ofNullable(getIsTerminationCurrency()).ifPresent(builder::setIsTerminationCurrency);
			ofNullable(getFxDesignatedCurrency()).ifPresent(builder::setFxDesignatedCurrency);
		}

		@Override
		public boolean equals(Object o) {
			if (this == o) return true;
			if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
		
			FxHaircutCurrency _that = getType().cast(o);
		
			if (!Objects.equals(isTerminationCurrency, _that.getIsTerminationCurrency())) return false;
			if (!Objects.equals(fxDesignatedCurrency, _that.getFxDesignatedCurrency())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (isTerminationCurrency != null ? isTerminationCurrency.hashCode() : 0);
			_result = 31 * _result + (fxDesignatedCurrency != null ? fxDesignatedCurrency.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "FxHaircutCurrency {" +
				"isTerminationCurrency=" + this.isTerminationCurrency + ", " +
				"fxDesignatedCurrency=" + this.fxDesignatedCurrency +
			'}';
		}
	}

	/*********************** Builder Implementation of FxHaircutCurrency  ***********************/
	class FxHaircutCurrencyBuilderImpl implements FxHaircutCurrency.FxHaircutCurrencyBuilder {
	
		protected Boolean isTerminationCurrency;
		protected FieldWithMetaString.FieldWithMetaStringBuilder fxDesignatedCurrency;
	
		public FxHaircutCurrencyBuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("isTerminationCurrency")
		public Boolean getIsTerminationCurrency() {
			return isTerminationCurrency;
		}
		
		@Override
		@RosettaAttribute("fxDesignatedCurrency")
		public FieldWithMetaString.FieldWithMetaStringBuilder getFxDesignatedCurrency() {
			return fxDesignatedCurrency;
		}
		
		@Override
		public FieldWithMetaString.FieldWithMetaStringBuilder getOrCreateFxDesignatedCurrency() {
			FieldWithMetaString.FieldWithMetaStringBuilder result;
			if (fxDesignatedCurrency!=null) {
				result = fxDesignatedCurrency;
			}
			else {
				result = fxDesignatedCurrency = FieldWithMetaString.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("isTerminationCurrency")
		public FxHaircutCurrency.FxHaircutCurrencyBuilder setIsTerminationCurrency(Boolean isTerminationCurrency) {
			this.isTerminationCurrency = isTerminationCurrency==null?null:isTerminationCurrency;
			return this;
		}
		@Override
		@RosettaAttribute("fxDesignatedCurrency")
		public FxHaircutCurrency.FxHaircutCurrencyBuilder setFxDesignatedCurrency(FieldWithMetaString fxDesignatedCurrency) {
			this.fxDesignatedCurrency = fxDesignatedCurrency==null?null:fxDesignatedCurrency.toBuilder();
			return this;
		}
		@Override
		public FxHaircutCurrency.FxHaircutCurrencyBuilder setFxDesignatedCurrencyValue(String fxDesignatedCurrency) {
			this.getOrCreateFxDesignatedCurrency().setValue(fxDesignatedCurrency);
			return this;
		}
		
		@Override
		public FxHaircutCurrency build() {
			return new FxHaircutCurrency.FxHaircutCurrencyImpl(this);
		}
		
		@Override
		public FxHaircutCurrency.FxHaircutCurrencyBuilder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public FxHaircutCurrency.FxHaircutCurrencyBuilder prune() {
			if (fxDesignatedCurrency!=null && !fxDesignatedCurrency.prune().hasData()) fxDesignatedCurrency = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getIsTerminationCurrency()!=null) return true;
			if (getFxDesignatedCurrency()!=null) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public FxHaircutCurrency.FxHaircutCurrencyBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			FxHaircutCurrency.FxHaircutCurrencyBuilder o = (FxHaircutCurrency.FxHaircutCurrencyBuilder) other;
			
			merger.mergeRosetta(getFxDesignatedCurrency(), o.getFxDesignatedCurrency(), this::setFxDesignatedCurrency);
			
			merger.mergeBasic(getIsTerminationCurrency(), o.getIsTerminationCurrency(), this::setIsTerminationCurrency);
			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;
		
			FxHaircutCurrency _that = getType().cast(o);
		
			if (!Objects.equals(isTerminationCurrency, _that.getIsTerminationCurrency())) return false;
			if (!Objects.equals(fxDesignatedCurrency, _that.getFxDesignatedCurrency())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (isTerminationCurrency != null ? isTerminationCurrency.hashCode() : 0);
			_result = 31 * _result + (fxDesignatedCurrency != null ? fxDesignatedCurrency.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "FxHaircutCurrencyBuilder {" +
				"isTerminationCurrency=" + this.isTerminationCurrency + ", " +
				"fxDesignatedCurrency=" + this.fxDesignatedCurrency +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy