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

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

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

import com.rosetta.jptlegalagreement.model.BusinessCenterEnum;
import com.rosetta.jptlegalagreement.model.CalculationDateLocationElection;
import com.rosetta.jptlegalagreement.model.CalculationDateLocationElection.CalculationDateLocationElectionBuilder;
import com.rosetta.jptlegalagreement.model.CalculationDateLocationElection.CalculationDateLocationElectionBuilderImpl;
import com.rosetta.jptlegalagreement.model.CalculationDateLocationElection.CalculationDateLocationElectionImpl;
import com.rosetta.jptlegalagreement.model.Party;
import com.rosetta.jptlegalagreement.model.meta.CalculationDateLocationElectionMeta;
import com.rosetta.jptlegalagreement.model.metafields.FieldWithMetaBusinessCenterEnum;
import com.rosetta.jptlegalagreement.model.metafields.FieldWithMetaBusinessCenterEnum.FieldWithMetaBusinessCenterEnumBuilder;
import com.rosetta.jptlegalagreement.model.metafields.ReferenceWithMetaParty;
import com.rosetta.jptlegalagreement.model.metafields.ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder;
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="CalculationDateLocationElection", builder=CalculationDateLocationElection.CalculationDateLocationElectionBuilderImpl.class, version="test")
public interface CalculationDateLocationElection extends RosettaModelObject {

	CalculationDateLocationElectionMeta metaData = new CalculationDateLocationElectionMeta();

	/*********************** Getter Methods  ***********************/
	ReferenceWithMetaParty getParty();
	FieldWithMetaBusinessCenterEnum getBusinessCenter();
	String getCustomLocation();

	/*********************** Build Methods  ***********************/
	CalculationDateLocationElection build();
	
	CalculationDateLocationElection.CalculationDateLocationElectionBuilder toBuilder();
	
	static CalculationDateLocationElection.CalculationDateLocationElectionBuilder builder() {
		return new CalculationDateLocationElection.CalculationDateLocationElectionBuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return CalculationDateLocationElection.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("party"), processor, ReferenceWithMetaParty.class, getParty());
		processRosetta(path.newSubPath("businessCenter"), processor, FieldWithMetaBusinessCenterEnum.class, getBusinessCenter());
		processor.processBasic(path.newSubPath("customLocation"), String.class, getCustomLocation(), this);
	}
	

	/*********************** Builder Interface  ***********************/
	interface CalculationDateLocationElectionBuilder extends CalculationDateLocationElection, RosettaModelObjectBuilder {
		ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder getOrCreateParty();
		ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder getParty();
		FieldWithMetaBusinessCenterEnum.FieldWithMetaBusinessCenterEnumBuilder getOrCreateBusinessCenter();
		FieldWithMetaBusinessCenterEnum.FieldWithMetaBusinessCenterEnumBuilder getBusinessCenter();
		CalculationDateLocationElection.CalculationDateLocationElectionBuilder setParty(ReferenceWithMetaParty party0);
		CalculationDateLocationElection.CalculationDateLocationElectionBuilder setPartyValue(Party party1);
		CalculationDateLocationElection.CalculationDateLocationElectionBuilder setBusinessCenter(FieldWithMetaBusinessCenterEnum businessCenter0);
		CalculationDateLocationElection.CalculationDateLocationElectionBuilder setBusinessCenterValue(BusinessCenterEnum businessCenter1);
		CalculationDateLocationElection.CalculationDateLocationElectionBuilder setCustomLocation(String customLocation);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("party"), processor, ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder.class, getParty());
			processRosetta(path.newSubPath("businessCenter"), processor, FieldWithMetaBusinessCenterEnum.FieldWithMetaBusinessCenterEnumBuilder.class, getBusinessCenter());
			processor.processBasic(path.newSubPath("customLocation"), String.class, getCustomLocation(), this);
		}
		

		CalculationDateLocationElection.CalculationDateLocationElectionBuilder prune();
	}

	/*********************** Immutable Implementation of CalculationDateLocationElection  ***********************/
	class CalculationDateLocationElectionImpl implements CalculationDateLocationElection {
		private final ReferenceWithMetaParty party;
		private final FieldWithMetaBusinessCenterEnum businessCenter;
		private final String customLocation;
		
		protected CalculationDateLocationElectionImpl(CalculationDateLocationElection.CalculationDateLocationElectionBuilder builder) {
			this.party = ofNullable(builder.getParty()).map(f->f.build()).orElse(null);
			this.businessCenter = ofNullable(builder.getBusinessCenter()).map(f->f.build()).orElse(null);
			this.customLocation = builder.getCustomLocation();
		}
		
		@Override
		@RosettaAttribute("party")
		public ReferenceWithMetaParty getParty() {
			return party;
		}
		
		@Override
		@RosettaAttribute("businessCenter")
		public FieldWithMetaBusinessCenterEnum getBusinessCenter() {
			return businessCenter;
		}
		
		@Override
		@RosettaAttribute("customLocation")
		public String getCustomLocation() {
			return customLocation;
		}
		
		@Override
		public CalculationDateLocationElection build() {
			return this;
		}
		
		@Override
		public CalculationDateLocationElection.CalculationDateLocationElectionBuilder toBuilder() {
			CalculationDateLocationElection.CalculationDateLocationElectionBuilder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(CalculationDateLocationElection.CalculationDateLocationElectionBuilder builder) {
			ofNullable(getParty()).ifPresent(builder::setParty);
			ofNullable(getBusinessCenter()).ifPresent(builder::setBusinessCenter);
			ofNullable(getCustomLocation()).ifPresent(builder::setCustomLocation);
		}

		@Override
		public boolean equals(Object o) {
			if (this == o) return true;
			if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
		
			CalculationDateLocationElection _that = getType().cast(o);
		
			if (!Objects.equals(party, _that.getParty())) return false;
			if (!Objects.equals(businessCenter, _that.getBusinessCenter())) return false;
			if (!Objects.equals(customLocation, _that.getCustomLocation())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (party != null ? party.hashCode() : 0);
			_result = 31 * _result + (businessCenter != null ? businessCenter.getClass().getName().hashCode() : 0);
			_result = 31 * _result + (customLocation != null ? customLocation.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "CalculationDateLocationElection {" +
				"party=" + this.party + ", " +
				"businessCenter=" + this.businessCenter + ", " +
				"customLocation=" + this.customLocation +
			'}';
		}
	}

	/*********************** Builder Implementation of CalculationDateLocationElection  ***********************/
	class CalculationDateLocationElectionBuilderImpl implements CalculationDateLocationElection.CalculationDateLocationElectionBuilder {
	
		protected ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder party;
		protected FieldWithMetaBusinessCenterEnum.FieldWithMetaBusinessCenterEnumBuilder businessCenter;
		protected String customLocation;
	
		public CalculationDateLocationElectionBuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("party")
		public ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder getParty() {
			return party;
		}
		
		@Override
		public ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder getOrCreateParty() {
			ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder result;
			if (party!=null) {
				result = party;
			}
			else {
				result = party = ReferenceWithMetaParty.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("businessCenter")
		public FieldWithMetaBusinessCenterEnum.FieldWithMetaBusinessCenterEnumBuilder getBusinessCenter() {
			return businessCenter;
		}
		
		@Override
		public FieldWithMetaBusinessCenterEnum.FieldWithMetaBusinessCenterEnumBuilder getOrCreateBusinessCenter() {
			FieldWithMetaBusinessCenterEnum.FieldWithMetaBusinessCenterEnumBuilder result;
			if (businessCenter!=null) {
				result = businessCenter;
			}
			else {
				result = businessCenter = FieldWithMetaBusinessCenterEnum.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("customLocation")
		public String getCustomLocation() {
			return customLocation;
		}
		
		@Override
		@RosettaAttribute("party")
		public CalculationDateLocationElection.CalculationDateLocationElectionBuilder setParty(ReferenceWithMetaParty party) {
			this.party = party==null?null:party.toBuilder();
			return this;
		}
		@Override
		public CalculationDateLocationElection.CalculationDateLocationElectionBuilder setPartyValue(Party party) {
			this.getOrCreateParty().setValue(party);
			return this;
		}
		@Override
		@RosettaAttribute("businessCenter")
		public CalculationDateLocationElection.CalculationDateLocationElectionBuilder setBusinessCenter(FieldWithMetaBusinessCenterEnum businessCenter) {
			this.businessCenter = businessCenter==null?null:businessCenter.toBuilder();
			return this;
		}
		@Override
		public CalculationDateLocationElection.CalculationDateLocationElectionBuilder setBusinessCenterValue(BusinessCenterEnum businessCenter) {
			this.getOrCreateBusinessCenter().setValue(businessCenter);
			return this;
		}
		@Override
		@RosettaAttribute("customLocation")
		public CalculationDateLocationElection.CalculationDateLocationElectionBuilder setCustomLocation(String customLocation) {
			this.customLocation = customLocation==null?null:customLocation;
			return this;
		}
		
		@Override
		public CalculationDateLocationElection build() {
			return new CalculationDateLocationElection.CalculationDateLocationElectionImpl(this);
		}
		
		@Override
		public CalculationDateLocationElection.CalculationDateLocationElectionBuilder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public CalculationDateLocationElection.CalculationDateLocationElectionBuilder prune() {
			if (party!=null && !party.prune().hasData()) party = null;
			if (businessCenter!=null && !businessCenter.prune().hasData()) businessCenter = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getParty()!=null && getParty().hasData()) return true;
			if (getBusinessCenter()!=null) return true;
			if (getCustomLocation()!=null) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public CalculationDateLocationElection.CalculationDateLocationElectionBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			CalculationDateLocationElection.CalculationDateLocationElectionBuilder o = (CalculationDateLocationElection.CalculationDateLocationElectionBuilder) other;
			
			merger.mergeRosetta(getParty(), o.getParty(), this::setParty);
			merger.mergeRosetta(getBusinessCenter(), o.getBusinessCenter(), this::setBusinessCenter);
			
			merger.mergeBasic(getCustomLocation(), o.getCustomLocation(), this::setCustomLocation);
			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;
		
			CalculationDateLocationElection _that = getType().cast(o);
		
			if (!Objects.equals(party, _that.getParty())) return false;
			if (!Objects.equals(businessCenter, _that.getBusinessCenter())) return false;
			if (!Objects.equals(customLocation, _that.getCustomLocation())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (party != null ? party.hashCode() : 0);
			_result = 31 * _result + (businessCenter != null ? businessCenter.getClass().getName().hashCode() : 0);
			_result = 31 * _result + (customLocation != null ? customLocation.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "CalculationDateLocationElectionBuilder {" +
				"party=" + this.party + ", " +
				"businessCenter=" + this.businessCenter + ", " +
				"customLocation=" + this.customLocation +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy