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

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

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

import com.rosetta.metatest.model.Asset12;
import com.rosetta.metatest.model.Observable12;
import com.rosetta.metatest.model.Observable12.Observable12Builder;
import com.rosetta.metatest.model.Observable12.Observable12BuilderImpl;
import com.rosetta.metatest.model.Observable12.Observable12Impl;
import com.rosetta.metatest.model.meta.Observable12Meta;
import com.rosetta.metatest.model.metafields.FieldWithMetaAsset12;
import com.rosetta.metatest.model.metafields.FieldWithMetaAsset12.FieldWithMetaAsset12Builder;
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="Observable12", builder=Observable12.Observable12BuilderImpl.class, version="test")
public interface Observable12 extends RosettaModelObject {

	Observable12Meta metaData = new Observable12Meta();

	/*********************** Getter Methods  ***********************/
	FieldWithMetaAsset12 getAsset12();

	/*********************** Build Methods  ***********************/
	Observable12 build();
	
	Observable12.Observable12Builder toBuilder();
	
	static Observable12.Observable12Builder builder() {
		return new Observable12.Observable12BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return Observable12.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("Asset12"), processor, FieldWithMetaAsset12.class, getAsset12());
	}
	

	/*********************** Builder Interface  ***********************/
	interface Observable12Builder extends Observable12, RosettaModelObjectBuilder {
		FieldWithMetaAsset12.FieldWithMetaAsset12Builder getOrCreateAsset12();
		FieldWithMetaAsset12.FieldWithMetaAsset12Builder getAsset12();
		Observable12.Observable12Builder setAsset12(FieldWithMetaAsset12 Asset120);
		Observable12.Observable12Builder setAsset12Value(Asset12 Asset121);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("Asset12"), processor, FieldWithMetaAsset12.FieldWithMetaAsset12Builder.class, getAsset12());
		}
		

		Observable12.Observable12Builder prune();
	}

	/*********************** Immutable Implementation of Observable12  ***********************/
	class Observable12Impl implements Observable12 {
		private final FieldWithMetaAsset12 asset12;
		
		protected Observable12Impl(Observable12.Observable12Builder builder) {
			this.asset12 = ofNullable(builder.getAsset12()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("Asset12")
		public FieldWithMetaAsset12 getAsset12() {
			return asset12;
		}
		
		@Override
		public Observable12 build() {
			return this;
		}
		
		@Override
		public Observable12.Observable12Builder toBuilder() {
			Observable12.Observable12Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(Observable12.Observable12Builder builder) {
			ofNullable(getAsset12()).ifPresent(builder::setAsset12);
		}

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

	/*********************** Builder Implementation of Observable12  ***********************/
	class Observable12BuilderImpl implements Observable12.Observable12Builder {
	
		protected FieldWithMetaAsset12.FieldWithMetaAsset12Builder asset12;
	
		public Observable12BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("Asset12")
		public FieldWithMetaAsset12.FieldWithMetaAsset12Builder getAsset12() {
			return asset12;
		}
		
		@Override
		public FieldWithMetaAsset12.FieldWithMetaAsset12Builder getOrCreateAsset12() {
			FieldWithMetaAsset12.FieldWithMetaAsset12Builder result;
			if (asset12!=null) {
				result = asset12;
			}
			else {
				result = asset12 = FieldWithMetaAsset12.builder();
				result.getOrCreateMeta().toBuilder().addKey(Key.builder().setScope("DOCUMENT"));
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("Asset12")
		public Observable12.Observable12Builder setAsset12(FieldWithMetaAsset12 asset12) {
			this.asset12 = asset12==null?null:asset12.toBuilder();
			return this;
		}
		@Override
		public Observable12.Observable12Builder setAsset12Value(Asset12 asset12) {
			this.getOrCreateAsset12().setValue(asset12);
			return this;
		}
		
		@Override
		public Observable12 build() {
			return new Observable12.Observable12Impl(this);
		}
		
		@Override
		public Observable12.Observable12Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Observable12.Observable12Builder prune() {
			if (asset12!=null && !asset12.prune().hasData()) asset12 = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getAsset12()!=null && getAsset12().hasData()) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Observable12.Observable12Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			Observable12.Observable12Builder o = (Observable12.Observable12Builder) other;
			
			merger.mergeRosetta(getAsset12(), o.getAsset12(), this::setAsset12);
			
			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;
		
			Observable12 _that = getType().cast(o);
		
			if (!Objects.equals(asset12, _that.getAsset12())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (asset12 != null ? asset12.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "Observable12Builder {" +
				"Asset12=" + this.asset12 +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy