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