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

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

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

import com.rosetta.jptlegalagreement.model.Party;
import com.rosetta.jptlegalagreement.model.ProcessAgentElection;
import com.rosetta.jptlegalagreement.model.ProcessAgentElection.ProcessAgentElectionBuilder;
import com.rosetta.jptlegalagreement.model.ProcessAgentElection.ProcessAgentElectionBuilderImpl;
import com.rosetta.jptlegalagreement.model.ProcessAgentElection.ProcessAgentElectionImpl;
import com.rosetta.jptlegalagreement.model.meta.ProcessAgentElectionMeta;
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="ProcessAgentElection", builder=ProcessAgentElection.ProcessAgentElectionBuilderImpl.class, version="test")
public interface ProcessAgentElection extends RosettaModelObject {

	ProcessAgentElectionMeta metaData = new ProcessAgentElectionMeta();

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

	/*********************** Build Methods  ***********************/
	ProcessAgentElection build();
	
	ProcessAgentElection.ProcessAgentElectionBuilder toBuilder();
	
	static ProcessAgentElection.ProcessAgentElectionBuilder builder() {
		return new ProcessAgentElection.ProcessAgentElectionBuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return ProcessAgentElection.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);
		processor.processBasic(path.newSubPath("specification"), String.class, getSpecification(), this);
	}
	

	/*********************** Builder Interface  ***********************/
	interface ProcessAgentElectionBuilder extends ProcessAgentElection, RosettaModelObjectBuilder {
		ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder getOrCreateParty();
		ReferenceWithMetaParty.ReferenceWithMetaPartyBuilder getParty();
		ProcessAgentElection.ProcessAgentElectionBuilder setParty(ReferenceWithMetaParty party0);
		ProcessAgentElection.ProcessAgentElectionBuilder setPartyValue(Party party1);
		ProcessAgentElection.ProcessAgentElectionBuilder setIsApplicable(Boolean isApplicable);
		ProcessAgentElection.ProcessAgentElectionBuilder setSpecification(String specification);

		@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);
			processor.processBasic(path.newSubPath("specification"), String.class, getSpecification(), this);
		}
		

		ProcessAgentElection.ProcessAgentElectionBuilder prune();
	}

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

		@Override
		public boolean equals(Object o) {
			if (this == o) return true;
			if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
		
			ProcessAgentElection _that = getType().cast(o);
		
			if (!Objects.equals(party, _that.getParty())) return false;
			if (!Objects.equals(isApplicable, _that.getIsApplicable())) return false;
			if (!Objects.equals(specification, _that.getSpecification())) 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);
			_result = 31 * _result + (specification != null ? specification.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "ProcessAgentElection {" +
				"party=" + this.party + ", " +
				"isApplicable=" + this.isApplicable + ", " +
				"specification=" + this.specification +
			'}';
		}
	}

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy