com.rosetta.testconditional.model.Top13 Maven / Gradle / Ivy
package com.rosetta.testconditional.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.testconditional.model.Top13;
import com.rosetta.testconditional.model.Top13.Top13Builder;
import com.rosetta.testconditional.model.Top13.Top13BuilderImpl;
import com.rosetta.testconditional.model.Top13.Top13Impl;
import com.rosetta.testconditional.model.V13;
import com.rosetta.testconditional.model.meta.Top13Meta;
import java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="Top13", builder=Top13.Top13BuilderImpl.class, version="test")
public interface Top13 extends RosettaModelObject {
Top13Meta metaData = new Top13Meta();
/*********************** Getter Methods ***********************/
V13 getVField1();
V13 getVField2();
/*********************** Build Methods ***********************/
Top13 build();
Top13.Top13Builder toBuilder();
static Top13.Top13Builder builder() {
return new Top13.Top13BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends Top13> metaData() {
return metaData;
}
@Override
default Class extends Top13> getType() {
return Top13.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processRosetta(path.newSubPath("vField1"), processor, V13.class, getVField1());
processRosetta(path.newSubPath("vField2"), processor, V13.class, getVField2());
}
/*********************** Builder Interface ***********************/
interface Top13Builder extends Top13, RosettaModelObjectBuilder {
V13.V13Builder getOrCreateVField1();
V13.V13Builder getVField1();
V13.V13Builder getOrCreateVField2();
V13.V13Builder getVField2();
Top13.Top13Builder setVField1(V13 vField1);
Top13.Top13Builder setVField2(V13 vField2);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processRosetta(path.newSubPath("vField1"), processor, V13.V13Builder.class, getVField1());
processRosetta(path.newSubPath("vField2"), processor, V13.V13Builder.class, getVField2());
}
Top13.Top13Builder prune();
}
/*********************** Immutable Implementation of Top13 ***********************/
class Top13Impl implements Top13 {
private final V13 vField1;
private final V13 vField2;
protected Top13Impl(Top13.Top13Builder builder) {
this.vField1 = ofNullable(builder.getVField1()).map(f->f.build()).orElse(null);
this.vField2 = ofNullable(builder.getVField2()).map(f->f.build()).orElse(null);
}
@Override
@RosettaAttribute("vField1")
public V13 getVField1() {
return vField1;
}
@Override
@RosettaAttribute("vField2")
public V13 getVField2() {
return vField2;
}
@Override
public Top13 build() {
return this;
}
@Override
public Top13.Top13Builder toBuilder() {
Top13.Top13Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(Top13.Top13Builder builder) {
ofNullable(getVField1()).ifPresent(builder::setVField1);
ofNullable(getVField2()).ifPresent(builder::setVField2);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
Top13 _that = getType().cast(o);
if (!Objects.equals(vField1, _that.getVField1())) return false;
if (!Objects.equals(vField2, _that.getVField2())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (vField1 != null ? vField1.hashCode() : 0);
_result = 31 * _result + (vField2 != null ? vField2.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "Top13 {" +
"vField1=" + this.vField1 + ", " +
"vField2=" + this.vField2 +
'}';
}
}
/*********************** Builder Implementation of Top13 ***********************/
class Top13BuilderImpl implements Top13.Top13Builder {
protected V13.V13Builder vField1;
protected V13.V13Builder vField2;
public Top13BuilderImpl() {
}
@Override
@RosettaAttribute("vField1")
public V13.V13Builder getVField1() {
return vField1;
}
@Override
public V13.V13Builder getOrCreateVField1() {
V13.V13Builder result;
if (vField1!=null) {
result = vField1;
}
else {
result = vField1 = V13.builder();
}
return result;
}
@Override
@RosettaAttribute("vField2")
public V13.V13Builder getVField2() {
return vField2;
}
@Override
public V13.V13Builder getOrCreateVField2() {
V13.V13Builder result;
if (vField2!=null) {
result = vField2;
}
else {
result = vField2 = V13.builder();
}
return result;
}
@Override
@RosettaAttribute("vField1")
public Top13.Top13Builder setVField1(V13 vField1) {
this.vField1 = vField1==null?null:vField1.toBuilder();
return this;
}
@Override
@RosettaAttribute("vField2")
public Top13.Top13Builder setVField2(V13 vField2) {
this.vField2 = vField2==null?null:vField2.toBuilder();
return this;
}
@Override
public Top13 build() {
return new Top13.Top13Impl(this);
}
@Override
public Top13.Top13Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public Top13.Top13Builder prune() {
if (vField1!=null && !vField1.prune().hasData()) vField1 = null;
if (vField2!=null && !vField2.prune().hasData()) vField2 = null;
return this;
}
@Override
public boolean hasData() {
if (getVField1()!=null && getVField1().hasData()) return true;
if (getVField2()!=null && getVField2().hasData()) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public Top13.Top13Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
Top13.Top13Builder o = (Top13.Top13Builder) other;
merger.mergeRosetta(getVField1(), o.getVField1(), this::setVField1);
merger.mergeRosetta(getVField2(), o.getVField2(), this::setVField2);
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;
Top13 _that = getType().cast(o);
if (!Objects.equals(vField1, _that.getVField1())) return false;
if (!Objects.equals(vField2, _that.getVField2())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (vField1 != null ? vField1.hashCode() : 0);
_result = 31 * _result + (vField2 != null ? vField2.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "Top13Builder {" +
"vField1=" + this.vField1 + ", " +
"vField2=" + this.vField2 +
'}';
}
}
}