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