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

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

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

import com.rosetta.metatest.model.Observable14;
import com.rosetta.metatest.model.PriceQuantity14;
import com.rosetta.metatest.model.PriceQuantity14.PriceQuantity14Builder;
import com.rosetta.metatest.model.PriceQuantity14.PriceQuantity14BuilderImpl;
import com.rosetta.metatest.model.PriceQuantity14.PriceQuantity14Impl;
import com.rosetta.metatest.model.meta.PriceQuantity14Meta;
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="PriceQuantity14", builder=PriceQuantity14.PriceQuantity14BuilderImpl.class, version="test")
public interface PriceQuantity14 extends RosettaModelObject {

	PriceQuantity14Meta metaData = new PriceQuantity14Meta();

	/*********************** Getter Methods  ***********************/
	Observable14 getObservable();

	/*********************** Build Methods  ***********************/
	PriceQuantity14 build();
	
	PriceQuantity14.PriceQuantity14Builder toBuilder();
	
	static PriceQuantity14.PriceQuantity14Builder builder() {
		return new PriceQuantity14.PriceQuantity14BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return PriceQuantity14.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("observable"), processor, Observable14.class, getObservable());
	}
	

	/*********************** Builder Interface  ***********************/
	interface PriceQuantity14Builder extends PriceQuantity14, RosettaModelObjectBuilder {
		Observable14.Observable14Builder getOrCreateObservable();
		Observable14.Observable14Builder getObservable();
		PriceQuantity14.PriceQuantity14Builder setObservable(Observable14 observable);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("observable"), processor, Observable14.Observable14Builder.class, getObservable());
		}
		

		PriceQuantity14.PriceQuantity14Builder prune();
	}

	/*********************** Immutable Implementation of PriceQuantity14  ***********************/
	class PriceQuantity14Impl implements PriceQuantity14 {
		private final Observable14 observable;
		
		protected PriceQuantity14Impl(PriceQuantity14.PriceQuantity14Builder builder) {
			this.observable = ofNullable(builder.getObservable()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("observable")
		public Observable14 getObservable() {
			return observable;
		}
		
		@Override
		public PriceQuantity14 build() {
			return this;
		}
		
		@Override
		public PriceQuantity14.PriceQuantity14Builder toBuilder() {
			PriceQuantity14.PriceQuantity14Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(PriceQuantity14.PriceQuantity14Builder builder) {
			ofNullable(getObservable()).ifPresent(builder::setObservable);
		}

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

	/*********************** Builder Implementation of PriceQuantity14  ***********************/
	class PriceQuantity14BuilderImpl implements PriceQuantity14.PriceQuantity14Builder {
	
		protected Observable14.Observable14Builder observable;
	
		public PriceQuantity14BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("observable")
		public Observable14.Observable14Builder getObservable() {
			return observable;
		}
		
		@Override
		public Observable14.Observable14Builder getOrCreateObservable() {
			Observable14.Observable14Builder result;
			if (observable!=null) {
				result = observable;
			}
			else {
				result = observable = Observable14.builder();
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("observable")
		public PriceQuantity14.PriceQuantity14Builder setObservable(Observable14 observable) {
			this.observable = observable==null?null:observable.toBuilder();
			return this;
		}
		
		@Override
		public PriceQuantity14 build() {
			return new PriceQuantity14.PriceQuantity14Impl(this);
		}
		
		@Override
		public PriceQuantity14.PriceQuantity14Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public PriceQuantity14.PriceQuantity14Builder prune() {
			if (observable!=null && !observable.prune().hasData()) observable = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getObservable()!=null && getObservable().hasData()) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public PriceQuantity14.PriceQuantity14Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			PriceQuantity14.PriceQuantity14Builder o = (PriceQuantity14.PriceQuantity14Builder) other;
			
			merger.mergeRosetta(getObservable(), o.getObservable(), this::setObservable);
			
			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;
		
			PriceQuantity14 _that = getType().cast(o);
		
			if (!Objects.equals(observable, _that.getObservable())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (observable != null ? observable.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "PriceQuantity14Builder {" +
				"observable=" + this.observable +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy