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

com.rosetta.metatest.model.Asset13 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;
import com.rosetta.metatest.model.Asset13.Asset13Builder;
import com.rosetta.metatest.model.Asset13.Asset13BuilderImpl;
import com.rosetta.metatest.model.Asset13.Asset13Impl;
import com.rosetta.metatest.model.meta.Asset13Meta;
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="Asset13", builder=Asset13.Asset13BuilderImpl.class, version="test")
public interface Asset13 extends RosettaModelObject {

	Asset13Meta metaData = new Asset13Meta();

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

	/*********************** Build Methods  ***********************/
	Asset13 build();
	
	Asset13.Asset13Builder toBuilder();
	
	static Asset13.Asset13Builder builder() {
		return new Asset13.Asset13BuilderImpl();
	}

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

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

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

		Asset13.Asset13Builder prune();
	}

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy