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

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

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

import com.rosetta.metatest.model.Observable11;
import com.rosetta.metatest.model.Observable11.Observable11Builder;
import com.rosetta.metatest.model.Observable11.Observable11BuilderImpl;
import com.rosetta.metatest.model.Observable11.Observable11Impl;
import com.rosetta.metatest.model.meta.Observable11Meta;
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.math.BigDecimal;
import java.util.Objects;

import static java.util.Optional.ofNullable;

/**
 * @version test
 */
@RosettaDataType(value="Observable11", builder=Observable11.Observable11BuilderImpl.class, version="test")
public interface Observable11 extends RosettaModelObject {

	Observable11Meta metaData = new Observable11Meta();

	/*********************** Getter Methods  ***********************/
	BigDecimal getAmount();

	/*********************** Build Methods  ***********************/
	Observable11 build();
	
	Observable11.Observable11Builder toBuilder();
	
	static Observable11.Observable11Builder builder() {
		return new Observable11.Observable11BuilderImpl();
	}

	/*********************** Utility Methods  ***********************/
	@Override
	default RosettaMetaData metaData() {
		return metaData;
	}
	
	@Override
	default Class getType() {
		return Observable11.class;
	}
	
	
	@Override
	default void process(RosettaPath path, Processor processor) {
		processor.processBasic(path.newSubPath("amount"), BigDecimal.class, getAmount(), this);
	}
	

	/*********************** Builder Interface  ***********************/
	interface Observable11Builder extends Observable11, RosettaModelObjectBuilder {
		Observable11.Observable11Builder setAmount(BigDecimal amount);

		@Override
		default void process(RosettaPath path, BuilderProcessor processor) {
			processor.processBasic(path.newSubPath("amount"), BigDecimal.class, getAmount(), this);
		}
		

		Observable11.Observable11Builder prune();
	}

	/*********************** Immutable Implementation of Observable11  ***********************/
	class Observable11Impl implements Observable11 {
		private final BigDecimal amount;
		
		protected Observable11Impl(Observable11.Observable11Builder builder) {
			this.amount = builder.getAmount();
		}
		
		@Override
		@RosettaAttribute("amount")
		public BigDecimal getAmount() {
			return amount;
		}
		
		@Override
		public Observable11 build() {
			return this;
		}
		
		@Override
		public Observable11.Observable11Builder toBuilder() {
			Observable11.Observable11Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(Observable11.Observable11Builder builder) {
			ofNullable(getAmount()).ifPresent(builder::setAmount);
		}

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

	/*********************** Builder Implementation of Observable11  ***********************/
	class Observable11BuilderImpl implements Observable11.Observable11Builder {
	
		protected BigDecimal amount;
	
		public Observable11BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("amount")
		public BigDecimal getAmount() {
			return amount;
		}
		
		@Override
		@RosettaAttribute("amount")
		public Observable11.Observable11Builder setAmount(BigDecimal amount) {
			this.amount = amount==null?null:amount;
			return this;
		}
		
		@Override
		public Observable11 build() {
			return new Observable11.Observable11Impl(this);
		}
		
		@Override
		public Observable11.Observable11Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Observable11.Observable11Builder prune() {
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getAmount()!=null) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Observable11.Observable11Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			Observable11.Observable11Builder o = (Observable11.Observable11Builder) other;
			
			
			merger.mergeBasic(getAmount(), o.getAmount(), this::setAmount);
			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;
		
			Observable11 _that = getType().cast(o);
		
			if (!Objects.equals(amount, _that.getAmount())) return false;
			return true;
		}
		
		@Override
		public int hashCode() {
			int _result = 0;
			_result = 31 * _result + (amount != null ? amount.hashCode() : 0);
			return _result;
		}
		
		@Override
		public String toString() {
			return "Observable11Builder {" +
				"amount=" + this.amount +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy