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

com.rosetta.externalsynonym.model.PartyTradeIdentifier2 Maven / Gradle / Ivy

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

import com.google.common.collect.ImmutableList;
import com.rosetta.externalsynonym.model.PartyTradeIdentifier2;
import com.rosetta.externalsynonym.model.PartyTradeIdentifier2.PartyTradeIdentifier2Builder;
import com.rosetta.externalsynonym.model.PartyTradeIdentifier2.PartyTradeIdentifier2BuilderImpl;
import com.rosetta.externalsynonym.model.PartyTradeIdentifier2.PartyTradeIdentifier2Impl;
import com.rosetta.externalsynonym.model.meta.PartyTradeIdentifier2Meta;
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 com.rosetta.util.ListEquals;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Collectors;

import static java.util.Optional.ofNullable;

/**
 * @version test
 */
@RosettaDataType(value="PartyTradeIdentifier2", builder=PartyTradeIdentifier2.PartyTradeIdentifier2BuilderImpl.class, version="test")
public interface PartyTradeIdentifier2 extends RosettaModelObject {

	PartyTradeIdentifier2Meta metaData = new PartyTradeIdentifier2Meta();

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

	/*********************** Build Methods  ***********************/
	PartyTradeIdentifier2 build();
	
	PartyTradeIdentifier2.PartyTradeIdentifier2Builder toBuilder();
	
	static PartyTradeIdentifier2.PartyTradeIdentifier2Builder builder() {
		return new PartyTradeIdentifier2.PartyTradeIdentifier2BuilderImpl();
	}

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

	/*********************** Builder Interface  ***********************/
	interface PartyTradeIdentifier2Builder extends PartyTradeIdentifier2, RosettaModelObjectBuilder {
		PartyTradeIdentifier2.PartyTradeIdentifier2Builder addParty(String party0);
		PartyTradeIdentifier2.PartyTradeIdentifier2Builder addParty(String party1, int _idx);
		PartyTradeIdentifier2.PartyTradeIdentifier2Builder addParty(List party2);
		PartyTradeIdentifier2.PartyTradeIdentifier2Builder setParty(List party3);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processor.processBasic(path.newSubPath("party"), String.class, getParty(), this);
		}
		

		PartyTradeIdentifier2.PartyTradeIdentifier2Builder prune();
	}

	/*********************** Immutable Implementation of PartyTradeIdentifier2  ***********************/
	class PartyTradeIdentifier2Impl implements PartyTradeIdentifier2 {
		private final List party;
		
		protected PartyTradeIdentifier2Impl(PartyTradeIdentifier2.PartyTradeIdentifier2Builder builder) {
			this.party = ofNullable(builder.getParty()).filter(_l->!_l.isEmpty()).map(ImmutableList::copyOf).orElse(null);
		}
		
		@Override
		@RosettaAttribute("party")
		public List getParty() {
			return party;
		}
		
		@Override
		public PartyTradeIdentifier2 build() {
			return this;
		}
		
		@Override
		public PartyTradeIdentifier2.PartyTradeIdentifier2Builder toBuilder() {
			PartyTradeIdentifier2.PartyTradeIdentifier2Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(PartyTradeIdentifier2.PartyTradeIdentifier2Builder 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;
		
			PartyTradeIdentifier2 _that = getType().cast(o);
		
			if (!ListEquals.listEquals(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 "PartyTradeIdentifier2 {" +
				"party=" + this.party +
			'}';
		}
	}

	/*********************** Builder Implementation of PartyTradeIdentifier2  ***********************/
	class PartyTradeIdentifier2BuilderImpl implements PartyTradeIdentifier2.PartyTradeIdentifier2Builder {
	
		protected List party = new ArrayList<>();
	
		public PartyTradeIdentifier2BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("party")
		public List getParty() {
			return party;
		}
		
		@Override
		public PartyTradeIdentifier2.PartyTradeIdentifier2Builder addParty(String party) {
			if (party!=null) this.party.add(party);
			return this;
		}
		
		@Override
		public PartyTradeIdentifier2.PartyTradeIdentifier2Builder addParty(String party, int _idx) {
			getIndex(this.party, _idx, () -> party);
			return this;
		}
		@Override 
		public PartyTradeIdentifier2.PartyTradeIdentifier2Builder addParty(List partys) {
			if (partys != null) {
				for (String toAdd : partys) {
					this.party.add(toAdd);
				}
			}
			return this;
		}
		
		@Override 
		@RosettaAttribute("party")
		public PartyTradeIdentifier2.PartyTradeIdentifier2Builder setParty(List partys) {
			if (partys == null)  {
				this.party = new ArrayList<>();
			}
			else {
				this.party = partys.stream()
					.collect(Collectors.toCollection(()->new ArrayList<>()));
			}
			return this;
		}
		
		
		@Override
		public PartyTradeIdentifier2 build() {
			return new PartyTradeIdentifier2.PartyTradeIdentifier2Impl(this);
		}
		
		@Override
		public PartyTradeIdentifier2.PartyTradeIdentifier2Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public PartyTradeIdentifier2.PartyTradeIdentifier2Builder prune() {
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getParty()!=null && !getParty().isEmpty()) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public PartyTradeIdentifier2.PartyTradeIdentifier2Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			PartyTradeIdentifier2.PartyTradeIdentifier2Builder o = (PartyTradeIdentifier2.PartyTradeIdentifier2Builder) other;
			
			
			merger.mergeBasic(getParty(), o.getParty(), (Consumer) this::addParty);
			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;
		
			PartyTradeIdentifier2 _that = getType().cast(o);
		
			if (!ListEquals.listEquals(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 "PartyTradeIdentifier2Builder {" +
				"party=" + this.party +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy