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

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

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

import com.rosetta.metatest.model.PriceQuantity11;
import com.rosetta.metatest.model.ResolvableObservable11;
import com.rosetta.metatest.model.Top11;
import com.rosetta.metatest.model.Top11.Top11Builder;
import com.rosetta.metatest.model.Top11.Top11BuilderImpl;
import com.rosetta.metatest.model.Top11.Top11Impl;
import com.rosetta.metatest.model.meta.Top11Meta;
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="Top11", builder=Top11.Top11BuilderImpl.class, version="test")
public interface Top11 extends RosettaModelObject {

	Top11Meta metaData = new Top11Meta();

	/*********************** Getter Methods  ***********************/
	PriceQuantity11 getPq();
	ResolvableObservable11 getRpq();

	/*********************** Build Methods  ***********************/
	Top11 build();
	
	Top11.Top11Builder toBuilder();
	
	static Top11.Top11Builder builder() {
		return new Top11.Top11BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return Top11.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("pq"), processor, PriceQuantity11.class, getPq());
		processRosetta(path.newSubPath("rpq"), processor, ResolvableObservable11.class, getRpq());
	}
	

	/*********************** Builder Interface  ***********************/
	interface Top11Builder extends Top11, RosettaModelObjectBuilder {
		PriceQuantity11.PriceQuantity11Builder getOrCreatePq();
		PriceQuantity11.PriceQuantity11Builder getPq();
		ResolvableObservable11.ResolvableObservable11Builder getOrCreateRpq();
		ResolvableObservable11.ResolvableObservable11Builder getRpq();
		Top11.Top11Builder setPq(PriceQuantity11 pq);
		Top11.Top11Builder setRpq(ResolvableObservable11 rpq);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("pq"), processor, PriceQuantity11.PriceQuantity11Builder.class, getPq());
			processRosetta(path.newSubPath("rpq"), processor, ResolvableObservable11.ResolvableObservable11Builder.class, getRpq());
		}
		

		Top11.Top11Builder prune();
	}

	/*********************** Immutable Implementation of Top11  ***********************/
	class Top11Impl implements Top11 {
		private final PriceQuantity11 pq;
		private final ResolvableObservable11 rpq;
		
		protected Top11Impl(Top11.Top11Builder builder) {
			this.pq = ofNullable(builder.getPq()).map(f->f.build()).orElse(null);
			this.rpq = ofNullable(builder.getRpq()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("pq")
		public PriceQuantity11 getPq() {
			return pq;
		}
		
		@Override
		@RosettaAttribute("rpq")
		public ResolvableObservable11 getRpq() {
			return rpq;
		}
		
		@Override
		public Top11 build() {
			return this;
		}
		
		@Override
		public Top11.Top11Builder toBuilder() {
			Top11.Top11Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(Top11.Top11Builder builder) {
			ofNullable(getPq()).ifPresent(builder::setPq);
			ofNullable(getRpq()).ifPresent(builder::setRpq);
		}

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

	/*********************** Builder Implementation of Top11  ***********************/
	class Top11BuilderImpl implements Top11.Top11Builder {
	
		protected PriceQuantity11.PriceQuantity11Builder pq;
		protected ResolvableObservable11.ResolvableObservable11Builder rpq;
	
		public Top11BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("pq")
		public PriceQuantity11.PriceQuantity11Builder getPq() {
			return pq;
		}
		
		@Override
		public PriceQuantity11.PriceQuantity11Builder getOrCreatePq() {
			PriceQuantity11.PriceQuantity11Builder result;
			if (pq!=null) {
				result = pq;
			}
			else {
				result = pq = PriceQuantity11.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("rpq")
		public ResolvableObservable11.ResolvableObservable11Builder getRpq() {
			return rpq;
		}
		
		@Override
		public ResolvableObservable11.ResolvableObservable11Builder getOrCreateRpq() {
			ResolvableObservable11.ResolvableObservable11Builder result;
			if (rpq!=null) {
				result = rpq;
			}
			else {
				result = rpq = ResolvableObservable11.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("pq")
		public Top11.Top11Builder setPq(PriceQuantity11 pq) {
			this.pq = pq==null?null:pq.toBuilder();
			return this;
		}
		@Override
		@RosettaAttribute("rpq")
		public Top11.Top11Builder setRpq(ResolvableObservable11 rpq) {
			this.rpq = rpq==null?null:rpq.toBuilder();
			return this;
		}
		
		@Override
		public Top11 build() {
			return new Top11.Top11Impl(this);
		}
		
		@Override
		public Top11.Top11Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Top11.Top11Builder prune() {
			if (pq!=null && !pq.prune().hasData()) pq = null;
			if (rpq!=null && !rpq.prune().hasData()) rpq = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getPq()!=null && getPq().hasData()) return true;
			if (getRpq()!=null && getRpq().hasData()) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Top11.Top11Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			Top11.Top11Builder o = (Top11.Top11Builder) other;
			
			merger.mergeRosetta(getPq(), o.getPq(), this::setPq);
			merger.mergeRosetta(getRpq(), o.getRpq(), this::setRpq);
			
			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;
		
			Top11 _that = getType().cast(o);
		
			if (!Objects.equals(pq, _that.getPq())) return false;
			if (!Objects.equals(rpq, _that.getRpq())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (pq != null ? pq.hashCode() : 0);
			_result = 31 * _result + (rpq != null ? rpq.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "Top11Builder {" +
				"pq=" + this.pq + ", " +
				"rpq=" + this.rpq +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy