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

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

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

import com.rosetta.jptlegalagreement.model.AdditionalRepresentationElection;
import com.rosetta.jptlegalagreement.model.AdditionalRepresentationElection.AdditionalRepresentationElectionBuilder;
import com.rosetta.jptlegalagreement.model.AdditionalRepresentationElection.AdditionalRepresentationElectionBuilderImpl;
import com.rosetta.jptlegalagreement.model.AdditionalRepresentationElection.AdditionalRepresentationElectionImpl;
import com.rosetta.jptlegalagreement.model.Party;
import com.rosetta.jptlegalagreement.model.meta.AdditionalRepresentationElectionMeta;
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="AdditionalRepresentationElection", builder=AdditionalRepresentationElection.AdditionalRepresentationElectionBuilderImpl.class, version="test")
public interface AdditionalRepresentationElection extends RosettaModelObject {

	AdditionalRepresentationElectionMeta metaData = new AdditionalRepresentationElectionMeta();

	/*********************** Getter Methods  ***********************/
	ReferenceWithMetaParty getParty();
	Boolean getIsApplicable();

	/*********************** Build Methods  ***********************/
	AdditionalRepresentationElection build();
	
	AdditionalRepresentationElection.AdditionalRepresentationElectionBuilder toBuilder();
	
	static AdditionalRepresentationElection.AdditionalRepresentationElectionBuilder builder() {
		return new AdditionalRepresentationElection.AdditionalRepresentationElectionBuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return AdditionalRepresentationElection.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("party"), processor, ReferenceWithMetaParty.class, getParty());
		processor.processBasic(path.newSubPath("isApplicable"), Boolean.class, getIsApplicable(), this);
	}
	

	/*********************** Builder Interface  ***********************/
	interface AdditionalRepresentationElectionBuilder extends AdditionalRepresentationElection, RosettaModelObjectBuilder {
		ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder getOrCreateParty();
		ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder getParty();
		AdditionalRepresentationElection.AdditionalRepresentationElectionBuilder setParty(ReferenceWithMetaParty party0);
		AdditionalRepresentationElection.AdditionalRepresentationElectionBuilder setPartyValue(Party party1);
		AdditionalRepresentationElection.AdditionalRepresentationElectionBuilder setIsApplicable(Boolean isApplicable);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("party"), processor, ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder.class, getParty());
			processor.processBasic(path.newSubPath("isApplicable"), Boolean.class, getIsApplicable(), this);
		}
		

		AdditionalRepresentationElection.AdditionalRepresentationElectionBuilder prune();
	}

	/*********************** Immutable Implementation of AdditionalRepresentationElection  ***********************/
	class AdditionalRepresentationElectionImpl implements AdditionalRepresentationElection {
		private final ReferenceWithMetaParty party;
		private final Boolean isApplicable;
		
		protected AdditionalRepresentationElectionImpl(AdditionalRepresentationElection.AdditionalRepresentationElectionBuilder builder) {
			this.party = ofNullable(builder.getParty()).map(f->f.build()).orElse(null);
			this.isApplicable = builder.getIsApplicable();
		}
		
		@Override
		@RosettaAttribute("party")
		public ReferenceWithMetaParty getParty() {
			return party;
		}
		
		@Override
		@RosettaAttribute("isApplicable")
		public Boolean getIsApplicable() {
			return isApplicable;
		}
		
		@Override
		public AdditionalRepresentationElection build() {
			return this;
		}
		
		@Override
		public AdditionalRepresentationElection.AdditionalRepresentationElectionBuilder toBuilder() {
			AdditionalRepresentationElection.AdditionalRepresentationElectionBuilder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(AdditionalRepresentationElection.AdditionalRepresentationElectionBuilder builder) {
			ofNullable(getParty()).ifPresent(builder::setParty);
			ofNullable(getIsApplicable()).ifPresent(builder::setIsApplicable);
		}

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

	/*********************** Builder Implementation of AdditionalRepresentationElection  ***********************/
	class AdditionalRepresentationElectionBuilderImpl implements AdditionalRepresentationElection.AdditionalRepresentationElectionBuilder {
	
		protected ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder party;
		protected Boolean isApplicable;
	
		public AdditionalRepresentationElectionBuilderImpl() {
		}
	
		@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("isApplicable")
		public Boolean getIsApplicable() {
			return isApplicable;
		}
		
		@Override
		@RosettaAttribute("party")
		public AdditionalRepresentationElection.AdditionalRepresentationElectionBuilder setParty(ReferenceWithMetaParty party) {
			this.party = party==null?null:party.toBuilder();
			return this;
		}
		@Override
		public AdditionalRepresentationElection.AdditionalRepresentationElectionBuilder setPartyValue(Party party) {
			this.getOrCreateParty().setValue(party);
			return this;
		}
		@Override
		@RosettaAttribute("isApplicable")
		public AdditionalRepresentationElection.AdditionalRepresentationElectionBuilder setIsApplicable(Boolean isApplicable) {
			this.isApplicable = isApplicable==null?null:isApplicable;
			return this;
		}
		
		@Override
		public AdditionalRepresentationElection build() {
			return new AdditionalRepresentationElection.AdditionalRepresentationElectionImpl(this);
		}
		
		@Override
		public AdditionalRepresentationElection.AdditionalRepresentationElectionBuilder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public AdditionalRepresentationElection.AdditionalRepresentationElectionBuilder prune() {
			if (party!=null && !party.prune().hasData()) party = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getParty()!=null && getParty().hasData()) return true;
			if (getIsApplicable()!=null) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public AdditionalRepresentationElection.AdditionalRepresentationElectionBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			AdditionalRepresentationElection.AdditionalRepresentationElectionBuilder o = (AdditionalRepresentationElection.AdditionalRepresentationElectionBuilder) other;
			
			merger.mergeRosetta(getParty(), o.getParty(), this::setParty);
			
			merger.mergeBasic(getIsApplicable(), o.getIsApplicable(), this::setIsApplicable);
			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;
		
			AdditionalRepresentationElection _that = getType().cast(o);
		
			if (!Objects.equals(party, _that.getParty())) return false;
			if (!Objects.equals(isApplicable, _that.getIsApplicable())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (party != null ? party.hashCode() : 0);
			_result = 31 * _result + (isApplicable != null ? isApplicable.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "AdditionalRepresentationElectionBuilder {" +
				"party=" + this.party + ", " +
				"isApplicable=" + this.isApplicable +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy