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

com.rosetta.metatest.model.PartyTradeIdentifier3 Maven / Gradle / Ivy

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

import com.rosetta.metatest.model.Party1;
import com.rosetta.metatest.model.PartyTradeIdentifier3;
import com.rosetta.metatest.model.PartyTradeIdentifier3.PartyTradeIdentifier3Builder;
import com.rosetta.metatest.model.PartyTradeIdentifier3.PartyTradeIdentifier3BuilderImpl;
import com.rosetta.metatest.model.PartyTradeIdentifier3.PartyTradeIdentifier3Impl;
import com.rosetta.metatest.model.meta.PartyTradeIdentifier3Meta;
import com.rosetta.metatest.model.metafields.ReferenceWithMetaParty1;
import com.rosetta.metatest.model.metafields.ReferenceWithMetaParty1.ReferenceWithMetaParty1Builder;
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="PartyTradeIdentifier3", builder=PartyTradeIdentifier3.PartyTradeIdentifier3BuilderImpl.class, version="test")
public interface PartyTradeIdentifier3 extends RosettaModelObject {

	PartyTradeIdentifier3Meta metaData = new PartyTradeIdentifier3Meta();

	/*********************** Getter Methods  ***********************/
	ReferenceWithMetaParty1 getParty();

	/*********************** Build Methods  ***********************/
	PartyTradeIdentifier3 build();
	
	PartyTradeIdentifier3.PartyTradeIdentifier3Builder toBuilder();
	
	static PartyTradeIdentifier3.PartyTradeIdentifier3Builder builder() {
		return new PartyTradeIdentifier3.PartyTradeIdentifier3BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return PartyTradeIdentifier3.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("party"), processor, ReferenceWithMetaParty1.class, getParty());
	}
	

	/*********************** Builder Interface  ***********************/
	interface PartyTradeIdentifier3Builder extends PartyTradeIdentifier3, RosettaModelObjectBuilder {
		ReferenceWithMetaParty1.ReferenceWithMetaParty1Builder getOrCreateParty();
		ReferenceWithMetaParty1.ReferenceWithMetaParty1Builder getParty();
		PartyTradeIdentifier3.PartyTradeIdentifier3Builder setParty(ReferenceWithMetaParty1 party0);
		PartyTradeIdentifier3.PartyTradeIdentifier3Builder setPartyValue(Party1 party1);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("party"), processor, ReferenceWithMetaParty1.ReferenceWithMetaParty1Builder.class, getParty());
		}
		

		PartyTradeIdentifier3.PartyTradeIdentifier3Builder prune();
	}

	/*********************** Immutable Implementation of PartyTradeIdentifier3  ***********************/
	class PartyTradeIdentifier3Impl implements PartyTradeIdentifier3 {
		private final ReferenceWithMetaParty1 party;
		
		protected PartyTradeIdentifier3Impl(PartyTradeIdentifier3.PartyTradeIdentifier3Builder builder) {
			this.party = ofNullable(builder.getParty()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("party")
		public ReferenceWithMetaParty1 getParty() {
			return party;
		}
		
		@Override
		public PartyTradeIdentifier3 build() {
			return this;
		}
		
		@Override
		public PartyTradeIdentifier3.PartyTradeIdentifier3Builder toBuilder() {
			PartyTradeIdentifier3.PartyTradeIdentifier3Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(PartyTradeIdentifier3.PartyTradeIdentifier3Builder builder) {
			ofNullable(getParty()).ifPresent(builder::setParty);
		}

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

	/*********************** Builder Implementation of PartyTradeIdentifier3  ***********************/
	class PartyTradeIdentifier3BuilderImpl implements PartyTradeIdentifier3.PartyTradeIdentifier3Builder {
	
		protected ReferenceWithMetaParty1.ReferenceWithMetaParty1Builder party;
	
		public PartyTradeIdentifier3BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("party")
		public ReferenceWithMetaParty1.ReferenceWithMetaParty1Builder getParty() {
			return party;
		}
		
		@Override
		public ReferenceWithMetaParty1.ReferenceWithMetaParty1Builder getOrCreateParty() {
			ReferenceWithMetaParty1.ReferenceWithMetaParty1Builder result;
			if (party!=null) {
				result = party;
			}
			else {
				result = party = ReferenceWithMetaParty1.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("party")
		public PartyTradeIdentifier3.PartyTradeIdentifier3Builder setParty(ReferenceWithMetaParty1 party) {
			this.party = party==null?null:party.toBuilder();
			return this;
		}
		@Override
		public PartyTradeIdentifier3.PartyTradeIdentifier3Builder setPartyValue(Party1 party) {
			this.getOrCreateParty().setValue(party);
			return this;
		}
		
		@Override
		public PartyTradeIdentifier3 build() {
			return new PartyTradeIdentifier3.PartyTradeIdentifier3Impl(this);
		}
		
		@Override
		public PartyTradeIdentifier3.PartyTradeIdentifier3Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public PartyTradeIdentifier3.PartyTradeIdentifier3Builder prune() {
			if (party!=null && !party.prune().hasData()) party = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getParty()!=null && getParty().hasData()) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public PartyTradeIdentifier3.PartyTradeIdentifier3Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			PartyTradeIdentifier3.PartyTradeIdentifier3Builder o = (PartyTradeIdentifier3.PartyTradeIdentifier3Builder) other;
			
			merger.mergeRosetta(getParty(), o.getParty(), this::setParty);
			
			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;
		
			PartyTradeIdentifier3 _that = getType().cast(o);
		
			if (!Objects.equals(party, _that.getParty())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (party != null ? party.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "PartyTradeIdentifier3Builder {" +
				"party=" + this.party +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy