com.rosetta.metatest.model.Asset12 Maven / Gradle / Ivy
package com.rosetta.metatest.model;
import com.rosetta.metatest.model.Asset12;
import com.rosetta.metatest.model.Asset12.Asset12Builder;
import com.rosetta.metatest.model.Asset12.Asset12BuilderImpl;
import com.rosetta.metatest.model.Asset12.Asset12Impl;
import com.rosetta.metatest.model.meta.Asset12Meta;
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="Asset12", builder=Asset12.Asset12BuilderImpl.class, version="test")
public interface Asset12 extends RosettaModelObject {
Asset12Meta metaData = new Asset12Meta();
/*********************** Getter Methods ***********************/
BigDecimal getAmount();
/*********************** Build Methods ***********************/
Asset12 build();
Asset12.Asset12Builder toBuilder();
static Asset12.Asset12Builder builder() {
return new Asset12.Asset12BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends Asset12> metaData() {
return metaData;
}
@Override
default Class extends Asset12> getType() {
return Asset12.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processor.processBasic(path.newSubPath("amount"), BigDecimal.class, getAmount(), this);
}
/*********************** Builder Interface ***********************/
interface Asset12Builder extends Asset12, RosettaModelObjectBuilder {
Asset12.Asset12Builder setAmount(BigDecimal amount);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processor.processBasic(path.newSubPath("amount"), BigDecimal.class, getAmount(), this);
}
Asset12.Asset12Builder prune();
}
/*********************** Immutable Implementation of Asset12 ***********************/
class Asset12Impl implements Asset12 {
private final BigDecimal amount;
protected Asset12Impl(Asset12.Asset12Builder builder) {
this.amount = builder.getAmount();
}
@Override
@RosettaAttribute("amount")
public BigDecimal getAmount() {
return amount;
}
@Override
public Asset12 build() {
return this;
}
@Override
public Asset12.Asset12Builder toBuilder() {
Asset12.Asset12Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(Asset12.Asset12Builder 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;
Asset12 _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 "Asset12 {" +
"amount=" + this.amount +
'}';
}
}
/*********************** Builder Implementation of Asset12 ***********************/
class Asset12BuilderImpl implements Asset12.Asset12Builder {
protected BigDecimal amount;
public Asset12BuilderImpl() {
}
@Override
@RosettaAttribute("amount")
public BigDecimal getAmount() {
return amount;
}
@Override
@RosettaAttribute("amount")
public Asset12.Asset12Builder setAmount(BigDecimal amount) {
this.amount = amount==null?null:amount;
return this;
}
@Override
public Asset12 build() {
return new Asset12.Asset12Impl(this);
}
@Override
public Asset12.Asset12Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public Asset12.Asset12Builder prune() {
return this;
}
@Override
public boolean hasData() {
if (getAmount()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public Asset12.Asset12Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
Asset12.Asset12Builder o = (Asset12.Asset12Builder) 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;
Asset12 _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 "Asset12Builder {" +
"amount=" + this.amount +
'}';
}
}
}