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

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

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

import com.rosetta.metatest.model.Observable11;
import com.rosetta.metatest.model.PriceQuantity11;
import com.rosetta.metatest.model.PriceQuantity11.PriceQuantity11Builder;
import com.rosetta.metatest.model.PriceQuantity11.PriceQuantity11BuilderImpl;
import com.rosetta.metatest.model.PriceQuantity11.PriceQuantity11Impl;
import com.rosetta.metatest.model.meta.PriceQuantity11Meta;
import com.rosetta.metatest.model.metafields.FieldWithMetaObservable11;
import com.rosetta.metatest.model.metafields.FieldWithMetaObservable11.FieldWithMetaObservable11Builder;
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.Key;
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="PriceQuantity11", builder=PriceQuantity11.PriceQuantity11BuilderImpl.class, version="test")
public interface PriceQuantity11 extends RosettaModelObject {

	PriceQuantity11Meta metaData = new PriceQuantity11Meta();

	/*********************** Getter Methods  ***********************/
	FieldWithMetaObservable11 getObservable11();

	/*********************** Build Methods  ***********************/
	PriceQuantity11 build();
	
	PriceQuantity11.PriceQuantity11Builder toBuilder();
	
	static PriceQuantity11.PriceQuantity11Builder builder() {
		return new PriceQuantity11.PriceQuantity11BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return PriceQuantity11.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("Observable11"), processor, FieldWithMetaObservable11.class, getObservable11());
	}
	

	/*********************** Builder Interface  ***********************/
	interface PriceQuantity11Builder extends PriceQuantity11, RosettaModelObjectBuilder {
		FieldWithMetaObservable11.FieldWithMetaObservable11Builder getOrCreateObservable11();
		FieldWithMetaObservable11.FieldWithMetaObservable11Builder getObservable11();
		PriceQuantity11.PriceQuantity11Builder setObservable11(FieldWithMetaObservable11 Observable110);
		PriceQuantity11.PriceQuantity11Builder setObservable11Value(Observable11 Observable111);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("Observable11"), processor, FieldWithMetaObservable11.FieldWithMetaObservable11Builder.class, getObservable11());
		}
		

		PriceQuantity11.PriceQuantity11Builder prune();
	}

	/*********************** Immutable Implementation of PriceQuantity11  ***********************/
	class PriceQuantity11Impl implements PriceQuantity11 {
		private final FieldWithMetaObservable11 observable11;
		
		protected PriceQuantity11Impl(PriceQuantity11.PriceQuantity11Builder builder) {
			this.observable11 = ofNullable(builder.getObservable11()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("Observable11")
		public FieldWithMetaObservable11 getObservable11() {
			return observable11;
		}
		
		@Override
		public PriceQuantity11 build() {
			return this;
		}
		
		@Override
		public PriceQuantity11.PriceQuantity11Builder toBuilder() {
			PriceQuantity11.PriceQuantity11Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(PriceQuantity11.PriceQuantity11Builder builder) {
			ofNullable(getObservable11()).ifPresent(builder::setObservable11);
		}

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

	/*********************** Builder Implementation of PriceQuantity11  ***********************/
	class PriceQuantity11BuilderImpl implements PriceQuantity11.PriceQuantity11Builder {
	
		protected FieldWithMetaObservable11.FieldWithMetaObservable11Builder observable11;
	
		public PriceQuantity11BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("Observable11")
		public FieldWithMetaObservable11.FieldWithMetaObservable11Builder getObservable11() {
			return observable11;
		}
		
		@Override
		public FieldWithMetaObservable11.FieldWithMetaObservable11Builder getOrCreateObservable11() {
			FieldWithMetaObservable11.FieldWithMetaObservable11Builder result;
			if (observable11!=null) {
				result = observable11;
			}
			else {
				result = observable11 = FieldWithMetaObservable11.builder();
				result.getOrCreateMeta().toBuilder().addKey(Key.builder().setScope("DOCUMENT"));
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("Observable11")
		public PriceQuantity11.PriceQuantity11Builder setObservable11(FieldWithMetaObservable11 observable11) {
			this.observable11 = observable11==null?null:observable11.toBuilder();
			return this;
		}
		@Override
		public PriceQuantity11.PriceQuantity11Builder setObservable11Value(Observable11 observable11) {
			this.getOrCreateObservable11().setValue(observable11);
			return this;
		}
		
		@Override
		public PriceQuantity11 build() {
			return new PriceQuantity11.PriceQuantity11Impl(this);
		}
		
		@Override
		public PriceQuantity11.PriceQuantity11Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public PriceQuantity11.PriceQuantity11Builder prune() {
			if (observable11!=null && !observable11.prune().hasData()) observable11 = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getObservable11()!=null && getObservable11().hasData()) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public PriceQuantity11.PriceQuantity11Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			PriceQuantity11.PriceQuantity11Builder o = (PriceQuantity11.PriceQuantity11Builder) other;
			
			merger.mergeRosetta(getObservable11(), o.getObservable11(), this::setObservable11);
			
			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;
		
			PriceQuantity11 _that = getType().cast(o);
		
			if (!Objects.equals(observable11, _that.getObservable11())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (observable11 != null ? observable11.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "PriceQuantity11Builder {" +
				"Observable11=" + this.observable11 +
			'}';
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy