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

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

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

import com.rosetta.metatest.model.Instrument14;
import com.rosetta.metatest.model.Instrument14.Instrument14Builder;
import com.rosetta.metatest.model.Instrument14.Instrument14BuilderImpl;
import com.rosetta.metatest.model.Instrument14.Instrument14Impl;
import com.rosetta.metatest.model.meta.Instrument14Meta;
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="Instrument14", builder=Instrument14.Instrument14BuilderImpl.class, version="test")
public interface Instrument14 extends RosettaModelObject {

	Instrument14Meta metaData = new Instrument14Meta();

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

	/*********************** Build Methods  ***********************/
	Instrument14 build();
	
	Instrument14.Instrument14Builder toBuilder();
	
	static Instrument14.Instrument14Builder builder() {
		return new Instrument14.Instrument14BuilderImpl();
	}

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

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

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

		Instrument14.Instrument14Builder prune();
	}

	/*********************** Immutable Implementation of Instrument14  ***********************/
	class Instrument14Impl implements Instrument14 {
		private final BigDecimal amount;
		
		protected Instrument14Impl(Instrument14.Instrument14Builder builder) {
			this.amount = builder.getAmount();
		}
		
		@Override
		@RosettaAttribute("amount")
		public BigDecimal getAmount() {
			return amount;
		}
		
		@Override
		public Instrument14 build() {
			return this;
		}
		
		@Override
		public Instrument14.Instrument14Builder toBuilder() {
			Instrument14.Instrument14Builder builder = builder();
			setBuilderFields(builder);
			return builder;
		}
		
		protected void setBuilderFields(Instrument14.Instrument14Builder 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;
		
			Instrument14 _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 "Instrument14 {" +
				"amount=" + this.amount +
			'}';
		}
	}

	/*********************** Builder Implementation of Instrument14  ***********************/
	class Instrument14BuilderImpl implements Instrument14.Instrument14Builder {
	
		protected BigDecimal amount;
	
		public Instrument14BuilderImpl() {
		}
	
		@Override
		@RosettaAttribute("amount")
		public BigDecimal getAmount() {
			return amount;
		}
		
		@Override
		@RosettaAttribute("amount")
		public Instrument14.Instrument14Builder setAmount(BigDecimal amount) {
			this.amount = amount==null?null:amount;
			return this;
		}
		
		@Override
		public Instrument14 build() {
			return new Instrument14.Instrument14Impl(this);
		}
		
		@Override
		public Instrument14.Instrument14Builder toBuilder() {
			return this;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Instrument14.Instrument14Builder prune() {
			return this;
		}
		
		@Override
		public boolean hasData() {
			if (getAmount()!=null) return true;
			return false;
		}
	
		@SuppressWarnings("unchecked")
		@Override
		public Instrument14.Instrument14Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
			Instrument14.Instrument14Builder o = (Instrument14.Instrument14Builder) 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;
		
			Instrument14 _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 "Instrument14Builder {" +
				"amount=" + this.amount +
			'}';
		}
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy