com.rosetta.jptlegalagreement.model.CustodianRisk Maven / Gradle / Ivy
package com.rosetta.jptlegalagreement.model;
import com.rosetta.jptlegalagreement.model.CustodianRisk;
import com.rosetta.jptlegalagreement.model.CustodianRisk.CustodianRiskBuilder;
import com.rosetta.jptlegalagreement.model.CustodianRisk.CustodianRiskBuilderImpl;
import com.rosetta.jptlegalagreement.model.CustodianRisk.CustodianRiskImpl;
import com.rosetta.jptlegalagreement.model.meta.CustodianRiskMeta;
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="CustodianRisk", builder=CustodianRisk.CustodianRiskBuilderImpl.class, version="test")
public interface CustodianRisk extends RosettaModelObject {
CustodianRiskMeta metaData = new CustodianRiskMeta();
/*********************** Getter Methods ***********************/
Boolean getIsSpecified();
String getQualification();
/*********************** Build Methods ***********************/
CustodianRisk build();
CustodianRisk.CustodianRiskBuilder toBuilder();
static CustodianRisk.CustodianRiskBuilder builder() {
return new CustodianRisk.CustodianRiskBuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends CustodianRisk> metaData() {
return metaData;
}
@Override
default Class extends CustodianRisk> getType() {
return CustodianRisk.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processor.processBasic(path.newSubPath("isSpecified"), Boolean.class, getIsSpecified(), this);
processor.processBasic(path.newSubPath("qualification"), String.class, getQualification(), this);
}
/*********************** Builder Interface ***********************/
interface CustodianRiskBuilder extends CustodianRisk, RosettaModelObjectBuilder {
CustodianRisk.CustodianRiskBuilder setIsSpecified(Boolean isSpecified);
CustodianRisk.CustodianRiskBuilder setQualification(String qualification);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processor.processBasic(path.newSubPath("isSpecified"), Boolean.class, getIsSpecified(), this);
processor.processBasic(path.newSubPath("qualification"), String.class, getQualification(), this);
}
CustodianRisk.CustodianRiskBuilder prune();
}
/*********************** Immutable Implementation of CustodianRisk ***********************/
class CustodianRiskImpl implements CustodianRisk {
private final Boolean isSpecified;
private final String qualification;
protected CustodianRiskImpl(CustodianRisk.CustodianRiskBuilder builder) {
this.isSpecified = builder.getIsSpecified();
this.qualification = builder.getQualification();
}
@Override
@RosettaAttribute("isSpecified")
public Boolean getIsSpecified() {
return isSpecified;
}
@Override
@RosettaAttribute("qualification")
public String getQualification() {
return qualification;
}
@Override
public CustodianRisk build() {
return this;
}
@Override
public CustodianRisk.CustodianRiskBuilder toBuilder() {
CustodianRisk.CustodianRiskBuilder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(CustodianRisk.CustodianRiskBuilder builder) {
ofNullable(getIsSpecified()).ifPresent(builder::setIsSpecified);
ofNullable(getQualification()).ifPresent(builder::setQualification);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
CustodianRisk _that = getType().cast(o);
if (!Objects.equals(isSpecified, _that.getIsSpecified())) return false;
if (!Objects.equals(qualification, _that.getQualification())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (isSpecified != null ? isSpecified.hashCode() : 0);
_result = 31 * _result + (qualification != null ? qualification.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "CustodianRisk {" +
"isSpecified=" + this.isSpecified + ", " +
"qualification=" + this.qualification +
'}';
}
}
/*********************** Builder Implementation of CustodianRisk ***********************/
class CustodianRiskBuilderImpl implements CustodianRisk.CustodianRiskBuilder {
protected Boolean isSpecified;
protected String qualification;
public CustodianRiskBuilderImpl() {
}
@Override
@RosettaAttribute("isSpecified")
public Boolean getIsSpecified() {
return isSpecified;
}
@Override
@RosettaAttribute("qualification")
public String getQualification() {
return qualification;
}
@Override
@RosettaAttribute("isSpecified")
public CustodianRisk.CustodianRiskBuilder setIsSpecified(Boolean isSpecified) {
this.isSpecified = isSpecified==null?null:isSpecified;
return this;
}
@Override
@RosettaAttribute("qualification")
public CustodianRisk.CustodianRiskBuilder setQualification(String qualification) {
this.qualification = qualification==null?null:qualification;
return this;
}
@Override
public CustodianRisk build() {
return new CustodianRisk.CustodianRiskImpl(this);
}
@Override
public CustodianRisk.CustodianRiskBuilder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public CustodianRisk.CustodianRiskBuilder prune() {
return this;
}
@Override
public boolean hasData() {
if (getIsSpecified()!=null) return true;
if (getQualification()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public CustodianRisk.CustodianRiskBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
CustodianRisk.CustodianRiskBuilder o = (CustodianRisk.CustodianRiskBuilder) other;
merger.mergeBasic(getIsSpecified(), o.getIsSpecified(), this::setIsSpecified);
merger.mergeBasic(getQualification(), o.getQualification(), this::setQualification);
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;
CustodianRisk _that = getType().cast(o);
if (!Objects.equals(isSpecified, _that.getIsSpecified())) return false;
if (!Objects.equals(qualification, _that.getQualification())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (isSpecified != null ? isSpecified.hashCode() : 0);
_result = 31 * _result + (qualification != null ? qualification.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "CustodianRiskBuilder {" +
"isSpecified=" + this.isSpecified + ", " +
"qualification=" + this.qualification +
'}';
}
}
}