com.rosetta.testconditional.model.X26_3 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.X26_3;
import com.rosetta.testconditional.model.X26_3.X26_3Builder;
import com.rosetta.testconditional.model.X26_3.X26_3BuilderImpl;
import com.rosetta.testconditional.model.X26_3.X26_3Impl;
import com.rosetta.testconditional.model.Y26_3;
import com.rosetta.testconditional.model.meta.X26_3Meta;
import java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="X26_3", builder=X26_3.X26_3BuilderImpl.class, version="test")
public interface X26_3 extends RosettaModelObject {
X26_3Meta metaData = new X26_3Meta();
/*********************** Getter Methods ***********************/
Y26_3 getY1Field();
Y26_3 getY2Field();
/*********************** Build Methods ***********************/
X26_3 build();
X26_3.X26_3Builder toBuilder();
static X26_3.X26_3Builder builder() {
return new X26_3.X26_3BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends X26_3> metaData() {
return metaData;
}
@Override
default Class extends X26_3> getType() {
return X26_3.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processRosetta(path.newSubPath("y1Field"), processor, Y26_3.class, getY1Field());
processRosetta(path.newSubPath("y2Field"), processor, Y26_3.class, getY2Field());
}
/*********************** Builder Interface ***********************/
interface X26_3Builder extends X26_3, RosettaModelObjectBuilder {
Y26_3.Y26_3Builder getOrCreateY1Field();
Y26_3.Y26_3Builder getY1Field();
Y26_3.Y26_3Builder getOrCreateY2Field();
Y26_3.Y26_3Builder getY2Field();
X26_3.X26_3Builder setY1Field(Y26_3 y1Field);
X26_3.X26_3Builder setY2Field(Y26_3 y2Field);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processRosetta(path.newSubPath("y1Field"), processor, Y26_3.Y26_3Builder.class, getY1Field());
processRosetta(path.newSubPath("y2Field"), processor, Y26_3.Y26_3Builder.class, getY2Field());
}
X26_3.X26_3Builder prune();
}
/*********************** Immutable Implementation of X26_3 ***********************/
class X26_3Impl implements X26_3 {
private final Y26_3 y1Field;
private final Y26_3 y2Field;
protected X26_3Impl(X26_3.X26_3Builder builder) {
this.y1Field = ofNullable(builder.getY1Field()).map(f->f.build()).orElse(null);
this.y2Field = ofNullable(builder.getY2Field()).map(f->f.build()).orElse(null);
}
@Override
@RosettaAttribute("y1Field")
public Y26_3 getY1Field() {
return y1Field;
}
@Override
@RosettaAttribute("y2Field")
public Y26_3 getY2Field() {
return y2Field;
}
@Override
public X26_3 build() {
return this;
}
@Override
public X26_3.X26_3Builder toBuilder() {
X26_3.X26_3Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(X26_3.X26_3Builder builder) {
ofNullable(getY1Field()).ifPresent(builder::setY1Field);
ofNullable(getY2Field()).ifPresent(builder::setY2Field);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
X26_3 _that = getType().cast(o);
if (!Objects.equals(y1Field, _that.getY1Field())) return false;
if (!Objects.equals(y2Field, _that.getY2Field())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (y1Field != null ? y1Field.hashCode() : 0);
_result = 31 * _result + (y2Field != null ? y2Field.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "X26_3 {" +
"y1Field=" + this.y1Field + ", " +
"y2Field=" + this.y2Field +
'}';
}
}
/*********************** Builder Implementation of X26_3 ***********************/
class X26_3BuilderImpl implements X26_3.X26_3Builder {
protected Y26_3.Y26_3Builder y1Field;
protected Y26_3.Y26_3Builder y2Field;
public X26_3BuilderImpl() {
}
@Override
@RosettaAttribute("y1Field")
public Y26_3.Y26_3Builder getY1Field() {
return y1Field;
}
@Override
public Y26_3.Y26_3Builder getOrCreateY1Field() {
Y26_3.Y26_3Builder result;
if (y1Field!=null) {
result = y1Field;
}
else {
result = y1Field = Y26_3.builder();
}
return result;
}
@Override
@RosettaAttribute("y2Field")
public Y26_3.Y26_3Builder getY2Field() {
return y2Field;
}
@Override
public Y26_3.Y26_3Builder getOrCreateY2Field() {
Y26_3.Y26_3Builder result;
if (y2Field!=null) {
result = y2Field;
}
else {
result = y2Field = Y26_3.builder();
}
return result;
}
@Override
@RosettaAttribute("y1Field")
public X26_3.X26_3Builder setY1Field(Y26_3 y1Field) {
this.y1Field = y1Field==null?null:y1Field.toBuilder();
return this;
}
@Override
@RosettaAttribute("y2Field")
public X26_3.X26_3Builder setY2Field(Y26_3 y2Field) {
this.y2Field = y2Field==null?null:y2Field.toBuilder();
return this;
}
@Override
public X26_3 build() {
return new X26_3.X26_3Impl(this);
}
@Override
public X26_3.X26_3Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public X26_3.X26_3Builder prune() {
if (y1Field!=null && !y1Field.prune().hasData()) y1Field = null;
if (y2Field!=null && !y2Field.prune().hasData()) y2Field = null;
return this;
}
@Override
public boolean hasData() {
if (getY1Field()!=null && getY1Field().hasData()) return true;
if (getY2Field()!=null && getY2Field().hasData()) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public X26_3.X26_3Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
X26_3.X26_3Builder o = (X26_3.X26_3Builder) other;
merger.mergeRosetta(getY1Field(), o.getY1Field(), this::setY1Field);
merger.mergeRosetta(getY2Field(), o.getY2Field(), this::setY2Field);
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;
X26_3 _that = getType().cast(o);
if (!Objects.equals(y1Field, _that.getY1Field())) return false;
if (!Objects.equals(y2Field, _that.getY2Field())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (y1Field != null ? y1Field.hashCode() : 0);
_result = 31 * _result + (y2Field != null ? y2Field.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "X26_3Builder {" +
"y1Field=" + this.y1Field + ", " +
"y2Field=" + this.y2Field +
'}';
}
}
}