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

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

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

import com.google.common.collect.ImmutableList;
import com.rosetta.metatest.model.PartyTradeIdentifier8;
import com.rosetta.metatest.model.PartyTradeIdentifier8.PartyTradeIdentifier8Builder;
import com.rosetta.metatest.model.PartyTradeIdentifier8.PartyTradeIdentifier8BuilderImpl;
import com.rosetta.metatest.model.PartyTradeIdentifier8.PartyTradeIdentifier8Impl;
import com.rosetta.metatest.model.meta.PartyTradeIdentifier8Meta;
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="PartyTradeIdentifier8", builder=PartyTradeIdentifier8.PartyTradeIdentifier8BuilderImpl.class, version="test")
public interface PartyTradeIdentifier8 extends RosettaModelObject {

	PartyTradeIdentifier8Meta metaData = new PartyTradeIdentifier8Meta();

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

	/*********************** Build Methods  ***********************/
	PartyTradeIdentifier8 build();
	
	PartyTradeIdentifier8.PartyTradeIdentifier8Builder toBuilder();
	
	static PartyTradeIdentifier8.PartyTradeIdentifier8Builder builder() {
		return new PartyTradeIdentifier8.PartyTradeIdentifier8BuilderImpl();
	}

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

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

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

		PartyTradeIdentifier8.PartyTradeIdentifier8Builder prune();
	}

	/*********************** Immutable Implementation of PartyTradeIdentifier8  ***********************/
	class PartyTradeIdentifier8Impl implements PartyTradeIdentifier8 {
		private final List party;
		
		protected PartyTradeIdentifier8Impl(PartyTradeIdentifier8.PartyTradeIdentifier8Builder 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 PartyTradeIdentifier8 build() {
			return this;
		}
		
		@Override
		public PartyTradeIdentifier8.PartyTradeIdentifier8Builder toBuilder() {
			PartyTradeIdentifier8.PartyTradeIdentifier8Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(PartyTradeIdentifier8.PartyTradeIdentifier8Builder 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;
		
			PartyTradeIdentifier8 _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 "PartyTradeIdentifier8 {" +
				"party=" + this.party +
			'}';
		}
	}

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy