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

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

	PartyTradeIdentifier3Meta metaData = new PartyTradeIdentifier3Meta();

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

	/*********************** 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) {
		processor.processBasic(path.newSubPath("partyEnum"), PartyEnum3.class, getPartyEnum(), this);
	}
	

	/*********************** Builder Interface  ***********************/
	interface PartyTradeIdentifier3Builder extends PartyTradeIdentifier3, RosettaModelObjectBuilder {
		PartyTradeIdentifier3.PartyTradeIdentifier3Builder addPartyEnum(PartyEnum3 partyEnum0);
		PartyTradeIdentifier3.PartyTradeIdentifier3Builder addPartyEnum(PartyEnum3 partyEnum1, int _idx);
		PartyTradeIdentifier3.PartyTradeIdentifier3Builder addPartyEnum(List partyEnum2);
		PartyTradeIdentifier3.PartyTradeIdentifier3Builder setPartyEnum(List partyEnum3);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processor.processBasic(path.newSubPath("partyEnum"), PartyEnum3.class, getPartyEnum(), this);
		}
		

		PartyTradeIdentifier3.PartyTradeIdentifier3Builder prune();
	}

	/*********************** Immutable Implementation of PartyTradeIdentifier3  ***********************/
	class PartyTradeIdentifier3Impl implements PartyTradeIdentifier3 {
		private final List partyEnum;
		
		protected PartyTradeIdentifier3Impl(PartyTradeIdentifier3.PartyTradeIdentifier3Builder builder) {
			this.partyEnum = ofNullable(builder.getPartyEnum()).filter(_l->!_l.isEmpty()).map(ImmutableList::copyOf).orElse(null);
		}
		
		@Override
		@RosettaAttribute("partyEnum")
		public List getPartyEnum() {
			return partyEnum;
		}
		
		@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(getPartyEnum()).ifPresent(builder::setPartyEnum);
		}

		@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 (!ListEquals.listEquals(partyEnum, _that.getPartyEnum())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (partyEnum != null ? partyEnum.stream().map(Object::getClass).map(Class::getName).mapToInt(String::hashCode).sum() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "PartyTradeIdentifier3 {" +
				"partyEnum=" + this.partyEnum +
			'}';
		}
	}

	/*********************** Builder Implementation of PartyTradeIdentifier3  ***********************/
	class PartyTradeIdentifier3BuilderImpl implements PartyTradeIdentifier3.PartyTradeIdentifier3Builder {
	
		protected List partyEnum = new ArrayList<>();
	
		public PartyTradeIdentifier3BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("partyEnum")
		public List getPartyEnum() {
			return partyEnum;
		}
		
		@Override
		public PartyTradeIdentifier3.PartyTradeIdentifier3Builder addPartyEnum(PartyEnum3 partyEnum) {
			if (partyEnum!=null) this.partyEnum.add(partyEnum);
			return this;
		}
		
		@Override
		public PartyTradeIdentifier3.PartyTradeIdentifier3Builder addPartyEnum(PartyEnum3 partyEnum, int _idx) {
			getIndex(this.partyEnum, _idx, () -> partyEnum);
			return this;
		}
		@Override 
		public PartyTradeIdentifier3.PartyTradeIdentifier3Builder addPartyEnum(List partyEnums) {
			if (partyEnums != null) {
				for (PartyEnum3 toAdd : partyEnums) {
					this.partyEnum.add(toAdd);
				}
			}
			return this;
		}
		
		@Override 
		@RosettaAttribute("partyEnum")
		public PartyTradeIdentifier3.PartyTradeIdentifier3Builder setPartyEnum(List partyEnums) {
			if (partyEnums == null)  {
				this.partyEnum = new ArrayList<>();
			}
			else {
				this.partyEnum = partyEnums.stream()
					.collect(Collectors.toCollection(()->new ArrayList<>()));
			}
			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() {
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getPartyEnum()!=null && !getPartyEnum().isEmpty()) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public PartyTradeIdentifier3.PartyTradeIdentifier3Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			PartyTradeIdentifier3.PartyTradeIdentifier3Builder o = (PartyTradeIdentifier3.PartyTradeIdentifier3Builder) other;
			
			
			merger.mergeBasic(getPartyEnum(), o.getPartyEnum(), (Consumer) this::addPartyEnum);
			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 (!ListEquals.listEquals(partyEnum, _that.getPartyEnum())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (partyEnum != null ? partyEnum.stream().map(Object::getClass).map(Class::getName).mapToInt(String::hashCode).sum() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "PartyTradeIdentifier3Builder {" +
				"partyEnum=" + this.partyEnum +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy