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

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

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

import com.rosetta.jptlegalagreement.model.PartyTerminationCurrency;
import com.rosetta.jptlegalagreement.model.PartyTerminationCurrency.PartyTerminationCurrencyBuilder;
import com.rosetta.jptlegalagreement.model.PartyTerminationCurrency.PartyTerminationCurrencyBuilderImpl;
import com.rosetta.jptlegalagreement.model.PartyTerminationCurrency.PartyTerminationCurrencyImpl;
import com.rosetta.jptlegalagreement.model.TerminationCurrencyElection;
import com.rosetta.jptlegalagreement.model.meta.PartyTerminationCurrencyMeta;
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="PartyTerminationCurrency", builder=PartyTerminationCurrency.PartyTerminationCurrencyBuilderImpl.class, version="test")
public interface PartyTerminationCurrency extends RosettaModelObject {

	PartyTerminationCurrencyMeta metaData = new PartyTerminationCurrencyMeta();

	/*********************** Getter Methods  ***********************/
	TerminationCurrencyElection getPartyElection();

	/*********************** Build Methods  ***********************/
	PartyTerminationCurrency build();
	
	PartyTerminationCurrency.PartyTerminationCurrencyBuilder toBuilder();
	
	static PartyTerminationCurrency.PartyTerminationCurrencyBuilder builder() {
		return new PartyTerminationCurrency.PartyTerminationCurrencyBuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return PartyTerminationCurrency.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("partyElection"), processor, TerminationCurrencyElection.class, getPartyElection());
	}
	

	/*********************** Builder Interface  ***********************/
	interface PartyTerminationCurrencyBuilder extends PartyTerminationCurrency, RosettaModelObjectBuilder {
		TerminationCurrencyElection.TerminationCurrencyElectionBuilder getOrCreatePartyElection();
		TerminationCurrencyElection.TerminationCurrencyElectionBuilder getPartyElection();
		PartyTerminationCurrency.PartyTerminationCurrencyBuilder setPartyElection(TerminationCurrencyElection partyElection);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("partyElection"), processor, TerminationCurrencyElection.TerminationCurrencyElectionBuilder.class, getPartyElection());
		}
		

		PartyTerminationCurrency.PartyTerminationCurrencyBuilder prune();
	}

	/*********************** Immutable Implementation of PartyTerminationCurrency  ***********************/
	class PartyTerminationCurrencyImpl implements PartyTerminationCurrency {
		private final TerminationCurrencyElection partyElection;
		
		protected PartyTerminationCurrencyImpl(PartyTerminationCurrency.PartyTerminationCurrencyBuilder builder) {
			this.partyElection = ofNullable(builder.getPartyElection()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("partyElection")
		public TerminationCurrencyElection getPartyElection() {
			return partyElection;
		}
		
		@Override
		public PartyTerminationCurrency build() {
			return this;
		}
		
		@Override
		public PartyTerminationCurrency.PartyTerminationCurrencyBuilder toBuilder() {
			PartyTerminationCurrency.PartyTerminationCurrencyBuilder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(PartyTerminationCurrency.PartyTerminationCurrencyBuilder builder) {
			ofNullable(getPartyElection()).ifPresent(builder::setPartyElection);
		}

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

	/*********************** Builder Implementation of PartyTerminationCurrency  ***********************/
	class PartyTerminationCurrencyBuilderImpl implements PartyTerminationCurrency.PartyTerminationCurrencyBuilder {
	
		protected TerminationCurrencyElection.TerminationCurrencyElectionBuilder partyElection;
	
		public PartyTerminationCurrencyBuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("partyElection")
		public TerminationCurrencyElection.TerminationCurrencyElectionBuilder getPartyElection() {
			return partyElection;
		}
		
		@Override
		public TerminationCurrencyElection.TerminationCurrencyElectionBuilder getOrCreatePartyElection() {
			TerminationCurrencyElection.TerminationCurrencyElectionBuilder result;
			if (partyElection!=null) {
				result = partyElection;
			}
			else {
				result = partyElection = TerminationCurrencyElection.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("partyElection")
		public PartyTerminationCurrency.PartyTerminationCurrencyBuilder setPartyElection(TerminationCurrencyElection partyElection) {
			this.partyElection = partyElection==null?null:partyElection.toBuilder();
			return this;
		}
		
		@Override
		public PartyTerminationCurrency build() {
			return new PartyTerminationCurrency.PartyTerminationCurrencyImpl(this);
		}
		
		@Override
		public PartyTerminationCurrency.PartyTerminationCurrencyBuilder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public PartyTerminationCurrency.PartyTerminationCurrencyBuilder prune() {
			if (partyElection!=null && !partyElection.prune().hasData()) partyElection = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getPartyElection()!=null && getPartyElection().hasData()) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public PartyTerminationCurrency.PartyTerminationCurrencyBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			PartyTerminationCurrency.PartyTerminationCurrencyBuilder o = (PartyTerminationCurrency.PartyTerminationCurrencyBuilder) other;
			
			merger.mergeRosetta(getPartyElection(), o.getPartyElection(), this::setPartyElection);
			
			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;
		
			PartyTerminationCurrency _that = getType().cast(o);
		
			if (!Objects.equals(partyElection, _that.getPartyElection())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (partyElection != null ? partyElection.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "PartyTerminationCurrencyBuilder {" +
				"partyElection=" + this.partyElection +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy