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

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

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

import com.rosetta.jptlegalagreement.model.CalculationDateLocation;
import com.rosetta.jptlegalagreement.model.CalculationDateLocation.CalculationDateLocationBuilder;
import com.rosetta.jptlegalagreement.model.CalculationDateLocation.CalculationDateLocationBuilderImpl;
import com.rosetta.jptlegalagreement.model.CalculationDateLocation.CalculationDateLocationImpl;
import com.rosetta.jptlegalagreement.model.CalculationDateLocationElection;
import com.rosetta.jptlegalagreement.model.meta.CalculationDateLocationMeta;
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="CalculationDateLocation", builder=CalculationDateLocation.CalculationDateLocationBuilderImpl.class, version="test")
public interface CalculationDateLocation extends RosettaModelObject {

	CalculationDateLocationMeta metaData = new CalculationDateLocationMeta();

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

	/*********************** Build Methods  ***********************/
	CalculationDateLocation build();
	
	CalculationDateLocation.CalculationDateLocationBuilder toBuilder();
	
	static CalculationDateLocation.CalculationDateLocationBuilder builder() {
		return new CalculationDateLocation.CalculationDateLocationBuilderImpl();
	}

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

	/*********************** Builder Interface  ***********************/
	interface CalculationDateLocationBuilder extends CalculationDateLocation, RosettaModelObjectBuilder {
		CalculationDateLocationElection.CalculationDateLocationElectionBuilder getOrCreatePartyElection();
		CalculationDateLocationElection.CalculationDateLocationElectionBuilder getPartyElection();
		CalculationDateLocation.CalculationDateLocationBuilder setPartyElection(CalculationDateLocationElection partyElection);

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

		CalculationDateLocation.CalculationDateLocationBuilder prune();
	}

	/*********************** Immutable Implementation of CalculationDateLocation  ***********************/
	class CalculationDateLocationImpl implements CalculationDateLocation {
		private final CalculationDateLocationElection partyElection;
		
		protected CalculationDateLocationImpl(CalculationDateLocation.CalculationDateLocationBuilder builder) {
			this.partyElection = ofNullable(builder.getPartyElection()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("partyElection")
		public CalculationDateLocationElection getPartyElection() {
			return partyElection;
		}
		
		@Override
		public CalculationDateLocation build() {
			return this;
		}
		
		@Override
		public CalculationDateLocation.CalculationDateLocationBuilder toBuilder() {
			CalculationDateLocation.CalculationDateLocationBuilder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(CalculationDateLocation.CalculationDateLocationBuilder 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;
		
			CalculationDateLocation _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 "CalculationDateLocation {" +
				"partyElection=" + this.partyElection +
			'}';
		}
	}

	/*********************** Builder Implementation of CalculationDateLocation  ***********************/
	class CalculationDateLocationBuilderImpl implements CalculationDateLocation.CalculationDateLocationBuilder {
	
		protected CalculationDateLocationElection.CalculationDateLocationElectionBuilder partyElection;
	
		public CalculationDateLocationBuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("partyElection")
		public CalculationDateLocationElection.CalculationDateLocationElectionBuilder getPartyElection() {
			return partyElection;
		}
		
		@Override
		public CalculationDateLocationElection.CalculationDateLocationElectionBuilder getOrCreatePartyElection() {
			CalculationDateLocationElection.CalculationDateLocationElectionBuilder result;
			if (partyElection!=null) {
				result = partyElection;
			}
			else {
				result = partyElection = CalculationDateLocationElection.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("partyElection")
		public CalculationDateLocation.CalculationDateLocationBuilder setPartyElection(CalculationDateLocationElection partyElection) {
			this.partyElection = partyElection==null?null:partyElection.toBuilder();
			return this;
		}
		
		@Override
		public CalculationDateLocation build() {
			return new CalculationDateLocation.CalculationDateLocationImpl(this);
		}
		
		@Override
		public CalculationDateLocation.CalculationDateLocationBuilder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public CalculationDateLocation.CalculationDateLocationBuilder 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 CalculationDateLocation.CalculationDateLocationBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			CalculationDateLocation.CalculationDateLocationBuilder o = (CalculationDateLocation.CalculationDateLocationBuilder) 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;
		
			CalculationDateLocation _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 "CalculationDateLocationBuilder {" +
				"partyElection=" + this.partyElection +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy