com.rosetta.jptchargorposting.model.EligibleCollateral Maven / Gradle / Ivy
package com.rosetta.jptchargorposting.model;
import com.rosetta.jptchargorposting.model.EligibleCollateral;
import com.rosetta.jptchargorposting.model.EligibleCollateral.EligibleCollateralBuilder;
import com.rosetta.jptchargorposting.model.EligibleCollateral.EligibleCollateralBuilderImpl;
import com.rosetta.jptchargorposting.model.EligibleCollateral.EligibleCollateralImpl;
import com.rosetta.jptchargorposting.model.meta.EligibleCollateralMeta;
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.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="EligibleCollateral", builder=EligibleCollateral.EligibleCollateralBuilderImpl.class, version="test")
public interface EligibleCollateral extends RosettaModelObject {
EligibleCollateralMeta metaData = new EligibleCollateralMeta();
/*********************** Getter Methods ***********************/
String getEligibleAsset();
String getValuationPercentage();
/*********************** Build Methods ***********************/
EligibleCollateral build();
EligibleCollateral.EligibleCollateralBuilder toBuilder();
static EligibleCollateral.EligibleCollateralBuilder builder() {
return new EligibleCollateral.EligibleCollateralBuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends EligibleCollateral> metaData() {
return metaData;
}
@Override
default Class extends EligibleCollateral> getType() {
return EligibleCollateral.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processor.processBasic(path.newSubPath("eligibleAsset"), String.class, getEligibleAsset(), this);
processor.processBasic(path.newSubPath("valuationPercentage"), String.class, getValuationPercentage(), this);
}
/*********************** Builder Interface ***********************/
interface EligibleCollateralBuilder extends EligibleCollateral, RosettaModelObjectBuilder {
EligibleCollateral.EligibleCollateralBuilder setEligibleAsset(String eligibleAsset);
EligibleCollateral.EligibleCollateralBuilder setValuationPercentage(String valuationPercentage);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processor.processBasic(path.newSubPath("eligibleAsset"), String.class, getEligibleAsset(), this);
processor.processBasic(path.newSubPath("valuationPercentage"), String.class, getValuationPercentage(), this);
}
EligibleCollateral.EligibleCollateralBuilder prune();
}
/*********************** Immutable Implementation of EligibleCollateral ***********************/
class EligibleCollateralImpl implements EligibleCollateral {
private final String eligibleAsset;
private final String valuationPercentage;
protected EligibleCollateralImpl(EligibleCollateral.EligibleCollateralBuilder builder) {
this.eligibleAsset = builder.getEligibleAsset();
this.valuationPercentage = builder.getValuationPercentage();
}
@Override
@RosettaAttribute("eligibleAsset")
public String getEligibleAsset() {
return eligibleAsset;
}
@Override
@RosettaAttribute("valuationPercentage")
public String getValuationPercentage() {
return valuationPercentage;
}
@Override
public EligibleCollateral build() {
return this;
}
@Override
public EligibleCollateral.EligibleCollateralBuilder toBuilder() {
EligibleCollateral.EligibleCollateralBuilder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(EligibleCollateral.EligibleCollateralBuilder builder) {
ofNullable(getEligibleAsset()).ifPresent(builder::setEligibleAsset);
ofNullable(getValuationPercentage()).ifPresent(builder::setValuationPercentage);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
EligibleCollateral _that = getType().cast(o);
if (!Objects.equals(eligibleAsset, _that.getEligibleAsset())) return false;
if (!Objects.equals(valuationPercentage, _that.getValuationPercentage())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (eligibleAsset != null ? eligibleAsset.hashCode() : 0);
_result = 31 * _result + (valuationPercentage != null ? valuationPercentage.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "EligibleCollateral {" +
"eligibleAsset=" + this.eligibleAsset + ", " +
"valuationPercentage=" + this.valuationPercentage +
'}';
}
}
/*********************** Builder Implementation of EligibleCollateral ***********************/
class EligibleCollateralBuilderImpl implements EligibleCollateral.EligibleCollateralBuilder {
protected String eligibleAsset;
protected String valuationPercentage;
public EligibleCollateralBuilderImpl() {
}
@Override
@RosettaAttribute("eligibleAsset")
public String getEligibleAsset() {
return eligibleAsset;
}
@Override
@RosettaAttribute("valuationPercentage")
public String getValuationPercentage() {
return valuationPercentage;
}
@Override
@RosettaAttribute("eligibleAsset")
public EligibleCollateral.EligibleCollateralBuilder setEligibleAsset(String eligibleAsset) {
this.eligibleAsset = eligibleAsset==null?null:eligibleAsset;
return this;
}
@Override
@RosettaAttribute("valuationPercentage")
public EligibleCollateral.EligibleCollateralBuilder setValuationPercentage(String valuationPercentage) {
this.valuationPercentage = valuationPercentage==null?null:valuationPercentage;
return this;
}
@Override
public EligibleCollateral build() {
return new EligibleCollateral.EligibleCollateralImpl(this);
}
@Override
public EligibleCollateral.EligibleCollateralBuilder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public EligibleCollateral.EligibleCollateralBuilder prune() {
return this;
}
@Override
public boolean hasData() {
if (getEligibleAsset()!=null) return true;
if (getValuationPercentage()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public EligibleCollateral.EligibleCollateralBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
EligibleCollateral.EligibleCollateralBuilder o = (EligibleCollateral.EligibleCollateralBuilder) other;
merger.mergeBasic(getEligibleAsset(), o.getEligibleAsset(), this::setEligibleAsset);
merger.mergeBasic(getValuationPercentage(), o.getValuationPercentage(), this::setValuationPercentage);
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;
EligibleCollateral _that = getType().cast(o);
if (!Objects.equals(eligibleAsset, _that.getEligibleAsset())) return false;
if (!Objects.equals(valuationPercentage, _that.getValuationPercentage())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (eligibleAsset != null ? eligibleAsset.hashCode() : 0);
_result = 31 * _result + (valuationPercentage != null ? valuationPercentage.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "EligibleCollateralBuilder {" +
"eligibleAsset=" + this.eligibleAsset + ", " +
"valuationPercentage=" + this.valuationPercentage +
'}';
}
}
}