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

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

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

import com.rosetta.metatest.model.PriceQuantity;
import com.rosetta.metatest.model.Quantity;
import com.rosetta.metatest.model.ResolvablePayoutQuantity;
import com.rosetta.metatest.model.Top10;
import com.rosetta.metatest.model.Top10.Top10Builder;
import com.rosetta.metatest.model.Top10.Top10BuilderImpl;
import com.rosetta.metatest.model.Top10.Top10Impl;
import com.rosetta.metatest.model.Top10_2;
import com.rosetta.metatest.model.Top10_2.Top10_2Builder;
import com.rosetta.metatest.model.Top10_2.Top10_2BuilderImpl;
import com.rosetta.metatest.model.Top10_2.Top10_2Impl;
import com.rosetta.metatest.model.meta.Top10_2Meta;
import com.rosetta.metatest.model.metafields.ReferenceWithMetaQuantity;
import com.rosetta.metatest.model.metafields.ReferenceWithMetaQuantity.ReferenceWithMetaQuantityBuilder;
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="Top10_2", builder=Top10_2.Top10_2BuilderImpl.class, version="test")
public interface Top10_2 extends Top10 {

	Top10_2Meta metaData = new Top10_2Meta();

	/*********************** Getter Methods  ***********************/
	ReferenceWithMetaQuantity getNotherQuantity();

	/*********************** Build Methods  ***********************/
	Top10_2 build();
	
	Top10_2.Top10_2Builder toBuilder();
	
	static Top10_2.Top10_2Builder builder() {
		return new Top10_2.Top10_2BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return Top10_2.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("pq"), processor, PriceQuantity.class, getPq());
		processRosetta(path.newSubPath("rpq"), processor, ResolvablePayoutQuantity.class, getRpq());
		processRosetta(path.newSubPath("notherQuantity"), processor, ReferenceWithMetaQuantity.class, getNotherQuantity());
	}
	

	/*********************** Builder Interface  ***********************/
	interface Top10_2Builder extends Top10_2, Top10.Top10Builder {
		ReferenceWithMetaQuantity.ReferenceWithMetaQuantityBuilder getOrCreateNotherQuantity();
		ReferenceWithMetaQuantity.ReferenceWithMetaQuantityBuilder getNotherQuantity();
		Top10_2.Top10_2Builder setPq(PriceQuantity pq);
		Top10_2.Top10_2Builder setRpq(ResolvablePayoutQuantity rpq);
		Top10_2.Top10_2Builder setNotherQuantity(ReferenceWithMetaQuantity notherQuantity0);
		Top10_2.Top10_2Builder setNotherQuantityValue(Quantity notherQuantity1);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("pq"), processor, PriceQuantity.PriceQuantityBuilder.class, getPq());
			processRosetta(path.newSubPath("rpq"), processor, ResolvablePayoutQuantity.ResolvablePayoutQuantityBuilder.class, getRpq());
			processRosetta(path.newSubPath("notherQuantity"), processor, ReferenceWithMetaQuantity.ReferenceWithMetaQuantityBuilder.class, getNotherQuantity());
		}
		

		Top10_2.Top10_2Builder prune();
	}

	/*********************** Immutable Implementation of Top10_2  ***********************/
	class Top10_2Impl extends Top10.Top10Impl implements Top10_2 {
		private final ReferenceWithMetaQuantity notherQuantity;
		
		protected Top10_2Impl(Top10_2.Top10_2Builder builder) {
			super(builder);
			this.notherQuantity = ofNullable(builder.getNotherQuantity()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("notherQuantity")
		public ReferenceWithMetaQuantity getNotherQuantity() {
			return notherQuantity;
		}
		
		@Override
		public Top10_2 build() {
			return this;
		}
		
		@Override
		public Top10_2.Top10_2Builder toBuilder() {
			Top10_2.Top10_2Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(Top10_2.Top10_2Builder builder) {
			super.setBuilderFields(builder);
			ofNullable(getNotherQuantity()).ifPresent(builder::setNotherQuantity);
		}

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

	/*********************** Builder Implementation of Top10_2  ***********************/
	class Top10_2BuilderImpl extends Top10.Top10BuilderImpl  implements Top10_2.Top10_2Builder {
	
		protected ReferenceWithMetaQuantity.ReferenceWithMetaQuantityBuilder notherQuantity;
	
		public Top10_2BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("notherQuantity")
		public ReferenceWithMetaQuantity.ReferenceWithMetaQuantityBuilder getNotherQuantity() {
			return notherQuantity;
		}
		
		@Override
		public ReferenceWithMetaQuantity.ReferenceWithMetaQuantityBuilder getOrCreateNotherQuantity() {
			ReferenceWithMetaQuantity.ReferenceWithMetaQuantityBuilder result;
			if (notherQuantity!=null) {
				result = notherQuantity;
			}
			else {
				result = notherQuantity = ReferenceWithMetaQuantity.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("pq")
		public Top10_2.Top10_2Builder setPq(PriceQuantity pq) {
			this.pq = pq==null?null:pq.toBuilder();
			return this;
		}
		@Override
		@RosettaAttribute("rpq")
		public Top10_2.Top10_2Builder setRpq(ResolvablePayoutQuantity rpq) {
			this.rpq = rpq==null?null:rpq.toBuilder();
			return this;
		}
		@Override
		@RosettaAttribute("notherQuantity")
		public Top10_2.Top10_2Builder setNotherQuantity(ReferenceWithMetaQuantity notherQuantity) {
			this.notherQuantity = notherQuantity==null?null:notherQuantity.toBuilder();
			return this;
		}
		@Override
		public Top10_2.Top10_2Builder setNotherQuantityValue(Quantity notherQuantity) {
			this.getOrCreateNotherQuantity().setValue(notherQuantity);
			return this;
		}
		
		@Override
		public Top10_2 build() {
			return new Top10_2.Top10_2Impl(this);
		}
		
		@Override
		public Top10_2.Top10_2Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Top10_2.Top10_2Builder prune() {
			super.prune();
			if (notherQuantity!=null && !notherQuantity.prune().hasData()) notherQuantity = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (super.hasData()) return true;
			if (getNotherQuantity()!=null && getNotherQuantity().hasData()) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Top10_2.Top10_2Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			super.merge(other, merger);
			
			Top10_2.Top10_2Builder o = (Top10_2.Top10_2Builder) other;
			
			merger.mergeRosetta(getNotherQuantity(), o.getNotherQuantity(), this::setNotherQuantity);
			
			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;
			if (!super.equals(o)) return false;
		
			Top10_2 _that = getType().cast(o);
		
			if (!Objects.equals(notherQuantity, _that.getNotherQuantity())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = super.hashCode();
			_result = 31 * _result + (notherQuantity != null ? notherQuantity.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "Top10_2Builder {" +
				"notherQuantity=" + this.notherQuantity +
			'}' + " " + super.toString();
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy