All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.rosetta.jsonparsingtests.model.TopJ Maven / Gradle / Ivy
package com.rosetta.jsonparsingtests.model;
import com.rosetta.jsonparsingtests.model.BespokeProvisions;
import com.rosetta.jsonparsingtests.model.Document;
import com.rosetta.jsonparsingtests.model.ExecutionDate;
import com.rosetta.jsonparsingtests.model.Parties;
import com.rosetta.jsonparsingtests.model.TopJ;
import com.rosetta.jsonparsingtests.model.TopJ.TopJBuilder;
import com.rosetta.jsonparsingtests.model.TopJ.TopJBuilderImpl;
import com.rosetta.jsonparsingtests.model.TopJ.TopJImpl;
import com.rosetta.jsonparsingtests.model.meta.TopJMeta;
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="TopJ", builder=TopJ.TopJBuilderImpl.class, version="test")
public interface TopJ extends RosettaModelObject {
TopJMeta metaData = new TopJMeta();
/*********************** Getter Methods ***********************/
Parties getAField();
ExecutionDate getBField();
BespokeProvisions getCField();
Document getDocField();
/*********************** Build Methods ***********************/
TopJ build();
TopJ.TopJBuilder toBuilder();
static TopJ.TopJBuilder builder() {
return new TopJ.TopJBuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends TopJ> metaData() {
return metaData;
}
@Override
default Class extends TopJ> getType() {
return TopJ.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processRosetta(path.newSubPath("aField"), processor, Parties.class, getAField());
processRosetta(path.newSubPath("bField"), processor, ExecutionDate.class, getBField());
processRosetta(path.newSubPath("cField"), processor, BespokeProvisions.class, getCField());
processRosetta(path.newSubPath("docField"), processor, Document.class, getDocField());
}
/*********************** Builder Interface ***********************/
interface TopJBuilder extends TopJ, RosettaModelObjectBuilder {
Parties.PartiesBuilder getOrCreateAField();
Parties.PartiesBuilder getAField();
ExecutionDate.ExecutionDateBuilder getOrCreateBField();
ExecutionDate.ExecutionDateBuilder getBField();
BespokeProvisions.BespokeProvisionsBuilder getOrCreateCField();
BespokeProvisions.BespokeProvisionsBuilder getCField();
Document.DocumentBuilder getOrCreateDocField();
Document.DocumentBuilder getDocField();
TopJ.TopJBuilder setAField(Parties aField);
TopJ.TopJBuilder setBField(ExecutionDate bField);
TopJ.TopJBuilder setCField(BespokeProvisions cField);
TopJ.TopJBuilder setDocField(Document docField);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processRosetta(path.newSubPath("aField"), processor, Parties.PartiesBuilder.class, getAField());
processRosetta(path.newSubPath("bField"), processor, ExecutionDate.ExecutionDateBuilder.class, getBField());
processRosetta(path.newSubPath("cField"), processor, BespokeProvisions.BespokeProvisionsBuilder.class, getCField());
processRosetta(path.newSubPath("docField"), processor, Document.DocumentBuilder.class, getDocField());
}
TopJ.TopJBuilder prune();
}
/*********************** Immutable Implementation of TopJ ***********************/
class TopJImpl implements TopJ {
private final Parties aField;
private final ExecutionDate bField;
private final BespokeProvisions cField;
private final Document docField;
protected TopJImpl(TopJ.TopJBuilder builder) {
this.aField = ofNullable(builder.getAField()).map(f->f.build()).orElse(null);
this.bField = ofNullable(builder.getBField()).map(f->f.build()).orElse(null);
this.cField = ofNullable(builder.getCField()).map(f->f.build()).orElse(null);
this.docField = ofNullable(builder.getDocField()).map(f->f.build()).orElse(null);
}
@Override
@RosettaAttribute("aField")
public Parties getAField() {
return aField;
}
@Override
@RosettaAttribute("bField")
public ExecutionDate getBField() {
return bField;
}
@Override
@RosettaAttribute("cField")
public BespokeProvisions getCField() {
return cField;
}
@Override
@RosettaAttribute("docField")
public Document getDocField() {
return docField;
}
@Override
public TopJ build() {
return this;
}
@Override
public TopJ.TopJBuilder toBuilder() {
TopJ.TopJBuilder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(TopJ.TopJBuilder builder) {
ofNullable(getAField()).ifPresent(builder::setAField);
ofNullable(getBField()).ifPresent(builder::setBField);
ofNullable(getCField()).ifPresent(builder::setCField);
ofNullable(getDocField()).ifPresent(builder::setDocField);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
TopJ _that = getType().cast(o);
if (!Objects.equals(aField, _that.getAField())) return false;
if (!Objects.equals(bField, _that.getBField())) return false;
if (!Objects.equals(cField, _that.getCField())) return false;
if (!Objects.equals(docField, _that.getDocField())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (aField != null ? aField.hashCode() : 0);
_result = 31 * _result + (bField != null ? bField.hashCode() : 0);
_result = 31 * _result + (cField != null ? cField.hashCode() : 0);
_result = 31 * _result + (docField != null ? docField.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "TopJ {" +
"aField=" + this.aField + ", " +
"bField=" + this.bField + ", " +
"cField=" + this.cField + ", " +
"docField=" + this.docField +
'}';
}
}
/*********************** Builder Implementation of TopJ ***********************/
class TopJBuilderImpl implements TopJ.TopJBuilder {
protected Parties.PartiesBuilder aField;
protected ExecutionDate.ExecutionDateBuilder bField;
protected BespokeProvisions.BespokeProvisionsBuilder cField;
protected Document.DocumentBuilder docField;
public TopJBuilderImpl() {
}
@Override
@RosettaAttribute("aField")
public Parties.PartiesBuilder getAField() {
return aField;
}
@Override
public Parties.PartiesBuilder getOrCreateAField() {
Parties.PartiesBuilder result;
if (aField!=null) {
result = aField;
}
else {
result = aField = Parties.builder();
}
return result;
}
@Override
@RosettaAttribute("bField")
public ExecutionDate.ExecutionDateBuilder getBField() {
return bField;
}
@Override
public ExecutionDate.ExecutionDateBuilder getOrCreateBField() {
ExecutionDate.ExecutionDateBuilder result;
if (bField!=null) {
result = bField;
}
else {
result = bField = ExecutionDate.builder();
}
return result;
}
@Override
@RosettaAttribute("cField")
public BespokeProvisions.BespokeProvisionsBuilder getCField() {
return cField;
}
@Override
public BespokeProvisions.BespokeProvisionsBuilder getOrCreateCField() {
BespokeProvisions.BespokeProvisionsBuilder result;
if (cField!=null) {
result = cField;
}
else {
result = cField = BespokeProvisions.builder();
}
return result;
}
@Override
@RosettaAttribute("docField")
public Document.DocumentBuilder getDocField() {
return docField;
}
@Override
public Document.DocumentBuilder getOrCreateDocField() {
Document.DocumentBuilder result;
if (docField!=null) {
result = docField;
}
else {
result = docField = Document.builder();
}
return result;
}
@Override
@RosettaAttribute("aField")
public TopJ.TopJBuilder setAField(Parties aField) {
this.aField = aField==null?null:aField.toBuilder();
return this;
}
@Override
@RosettaAttribute("bField")
public TopJ.TopJBuilder setBField(ExecutionDate bField) {
this.bField = bField==null?null:bField.toBuilder();
return this;
}
@Override
@RosettaAttribute("cField")
public TopJ.TopJBuilder setCField(BespokeProvisions cField) {
this.cField = cField==null?null:cField.toBuilder();
return this;
}
@Override
@RosettaAttribute("docField")
public TopJ.TopJBuilder setDocField(Document docField) {
this.docField = docField==null?null:docField.toBuilder();
return this;
}
@Override
public TopJ build() {
return new TopJ.TopJImpl(this);
}
@Override
public TopJ.TopJBuilder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public TopJ.TopJBuilder prune() {
if (aField!=null && !aField.prune().hasData()) aField = null;
if (bField!=null && !bField.prune().hasData()) bField = null;
if (cField!=null && !cField.prune().hasData()) cField = null;
if (docField!=null && !docField.prune().hasData()) docField = null;
return this;
}
@Override
public boolean hasData() {
if (getAField()!=null && getAField().hasData()) return true;
if (getBField()!=null && getBField().hasData()) return true;
if (getCField()!=null && getCField().hasData()) return true;
if (getDocField()!=null && getDocField().hasData()) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public TopJ.TopJBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
TopJ.TopJBuilder o = (TopJ.TopJBuilder) other;
merger.mergeRosetta(getAField(), o.getAField(), this::setAField);
merger.mergeRosetta(getBField(), o.getBField(), this::setBField);
merger.mergeRosetta(getCField(), o.getCField(), this::setCField);
merger.mergeRosetta(getDocField(), o.getDocField(), this::setDocField);
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;
TopJ _that = getType().cast(o);
if (!Objects.equals(aField, _that.getAField())) return false;
if (!Objects.equals(bField, _that.getBField())) return false;
if (!Objects.equals(cField, _that.getCField())) return false;
if (!Objects.equals(docField, _that.getDocField())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (aField != null ? aField.hashCode() : 0);
_result = 31 * _result + (bField != null ? bField.hashCode() : 0);
_result = 31 * _result + (cField != null ? cField.hashCode() : 0);
_result = 31 * _result + (docField != null ? docField.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "TopJBuilder {" +
"aField=" + this.aField + ", " +
"bField=" + this.bField + ", " +
"cField=" + this.cField + ", " +
"docField=" + this.docField +
'}';
}
}
}