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

com.rosetta.metatest.model.Observable13_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.Asset13_2;
import com.rosetta.metatest.model.Observable13_2;
import com.rosetta.metatest.model.Observable13_2.Observable13_2Builder;
import com.rosetta.metatest.model.Observable13_2.Observable13_2BuilderImpl;
import com.rosetta.metatest.model.Observable13_2.Observable13_2Impl;
import com.rosetta.metatest.model.meta.Observable13_2Meta;
import com.rosetta.metatest.model.metafields.FieldWithMetaAsset13_2;
import com.rosetta.metatest.model.metafields.FieldWithMetaAsset13_2.FieldWithMetaAsset13_2Builder;
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="Observable13_2", builder=Observable13_2.Observable13_2BuilderImpl.class, version="test")
public interface Observable13_2 extends RosettaModelObject {

	Observable13_2Meta metaData = new Observable13_2Meta();

	/*********************** Getter Methods  ***********************/
	FieldWithMetaAsset13_2 getAsset13_2();

	/*********************** Build Methods  ***********************/
	Observable13_2 build();
	
	Observable13_2.Observable13_2Builder toBuilder();
	
	static Observable13_2.Observable13_2Builder builder() {
		return new Observable13_2.Observable13_2BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return Observable13_2.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processRosetta(path.newSubPath("Asset13_2"), processor, FieldWithMetaAsset13_2.class, getAsset13_2());
	}
	

	/*********************** Builder Interface  ***********************/
	interface Observable13_2Builder extends Observable13_2, RosettaModelObjectBuilder {
		FieldWithMetaAsset13_2.FieldWithMetaAsset13_2Builder getOrCreateAsset13_2();
		FieldWithMetaAsset13_2.FieldWithMetaAsset13_2Builder getAsset13_2();
		Observable13_2.Observable13_2Builder setAsset13_2(FieldWithMetaAsset13_2 Asset13_20);
		Observable13_2.Observable13_2Builder setAsset13_2Value(Asset13_2 Asset13_21);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processRosetta(path.newSubPath("Asset13_2"), processor, FieldWithMetaAsset13_2.FieldWithMetaAsset13_2Builder.class, getAsset13_2());
		}
		

		Observable13_2.Observable13_2Builder prune();
	}

	/*********************** Immutable Implementation of Observable13_2  ***********************/
	class Observable13_2Impl implements Observable13_2 {
		private final FieldWithMetaAsset13_2 asset13_2;
		
		protected Observable13_2Impl(Observable13_2.Observable13_2Builder builder) {
			this.asset13_2 = ofNullable(builder.getAsset13_2()).map(f->f.build()).orElse(null);
		}
		
		@Override
		@RosettaAttribute("Asset13_2")
		public FieldWithMetaAsset13_2 getAsset13_2() {
			return asset13_2;
		}
		
		@Override
		public Observable13_2 build() {
			return this;
		}
		
		@Override
		public Observable13_2.Observable13_2Builder toBuilder() {
			Observable13_2.Observable13_2Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(Observable13_2.Observable13_2Builder builder) {
			ofNullable(getAsset13_2()).ifPresent(builder::setAsset13_2);
		}

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

	/*********************** Builder Implementation of Observable13_2  ***********************/
	class Observable13_2BuilderImpl implements Observable13_2.Observable13_2Builder {
	
		protected FieldWithMetaAsset13_2.FieldWithMetaAsset13_2Builder asset13_2;
	
		public Observable13_2BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("Asset13_2")
		public FieldWithMetaAsset13_2.FieldWithMetaAsset13_2Builder getAsset13_2() {
			return asset13_2;
		}
		
		@Override
		public FieldWithMetaAsset13_2.FieldWithMetaAsset13_2Builder getOrCreateAsset13_2() {
			FieldWithMetaAsset13_2.FieldWithMetaAsset13_2Builder result;
			if (asset13_2!=null) {
				result = asset13_2;
			}
			else {
				result = asset13_2 = FieldWithMetaAsset13_2.builder();
				result.getOrCreateMeta().toBuilder().addKey(Key.builder().setScope("DOCUMENT"));
			}
			
			return result;
		}
		
		@Override
		@RosettaAttribute("Asset13_2")
		public Observable13_2.Observable13_2Builder setAsset13_2(FieldWithMetaAsset13_2 asset13_2) {
			this.asset13_2 = asset13_2==null?null:asset13_2.toBuilder();
			return this;
		}
		@Override
		public Observable13_2.Observable13_2Builder setAsset13_2Value(Asset13_2 asset13_2) {
			this.getOrCreateAsset13_2().setValue(asset13_2);
			return this;
		}
		
		@Override
		public Observable13_2 build() {
			return new Observable13_2.Observable13_2Impl(this);
		}
		
		@Override
		public Observable13_2.Observable13_2Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Observable13_2.Observable13_2Builder prune() {
			if (asset13_2!=null && !asset13_2.prune().hasData()) asset13_2 = null;
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getAsset13_2()!=null && getAsset13_2().hasData()) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Observable13_2.Observable13_2Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			Observable13_2.Observable13_2Builder o = (Observable13_2.Observable13_2Builder) other;
			
			merger.mergeRosetta(getAsset13_2(), o.getAsset13_2(), this::setAsset13_2);
			
			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;
		
			Observable13_2 _that = getType().cast(o);
		
			if (!Objects.equals(asset13_2, _that.getAsset13_2())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (asset13_2 != null ? asset13_2.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "Observable13_2Builder {" +
				"Asset13_2=" + this.asset13_2 +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy