com.rosetta.testconditional.model.X28 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.X28;
import com.rosetta.testconditional.model.X28.X28Builder;
import com.rosetta.testconditional.model.X28.X28BuilderImpl;
import com.rosetta.testconditional.model.X28.X28Impl;
import com.rosetta.testconditional.model.Y28;
import com.rosetta.testconditional.model.meta.X28Meta;
import java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="X28", builder=X28.X28BuilderImpl.class, version="test")
public interface X28 extends RosettaModelObject {
X28Meta metaData = new X28Meta();
/*********************** Getter Methods ***********************/
Y28 getYField_s();
Y28 getYField_c();
/*********************** Build Methods ***********************/
X28 build();
X28.X28Builder toBuilder();
static X28.X28Builder builder() {
return new X28.X28BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends X28> metaData() {
return metaData;
}
@Override
default Class extends X28> getType() {
return X28.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processRosetta(path.newSubPath("yField_s"), processor, Y28.class, getYField_s());
processRosetta(path.newSubPath("yField_c"), processor, Y28.class, getYField_c());
}
/*********************** Builder Interface ***********************/
interface X28Builder extends X28, RosettaModelObjectBuilder {
Y28.Y28Builder getOrCreateYField_s();
Y28.Y28Builder getYField_s();
Y28.Y28Builder getOrCreateYField_c();
Y28.Y28Builder getYField_c();
X28.X28Builder setYField_s(Y28 yField_s);
X28.X28Builder setYField_c(Y28 yField_c);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processRosetta(path.newSubPath("yField_s"), processor, Y28.Y28Builder.class, getYField_s());
processRosetta(path.newSubPath("yField_c"), processor, Y28.Y28Builder.class, getYField_c());
}
X28.X28Builder prune();
}
/*********************** Immutable Implementation of X28 ***********************/
class X28Impl implements X28 {
private final Y28 yField_s;
private final Y28 yField_c;
protected X28Impl(X28.X28Builder builder) {
this.yField_s = ofNullable(builder.getYField_s()).map(f->f.build()).orElse(null);
this.yField_c = ofNullable(builder.getYField_c()).map(f->f.build()).orElse(null);
}
@Override
@RosettaAttribute("yField_s")
public Y28 getYField_s() {
return yField_s;
}
@Override
@RosettaAttribute("yField_c")
public Y28 getYField_c() {
return yField_c;
}
@Override
public X28 build() {
return this;
}
@Override
public X28.X28Builder toBuilder() {
X28.X28Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(X28.X28Builder builder) {
ofNullable(getYField_s()).ifPresent(builder::setYField_s);
ofNullable(getYField_c()).ifPresent(builder::setYField_c);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
X28 _that = getType().cast(o);
if (!Objects.equals(yField_s, _that.getYField_s())) return false;
if (!Objects.equals(yField_c, _that.getYField_c())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (yField_s != null ? yField_s.hashCode() : 0);
_result = 31 * _result + (yField_c != null ? yField_c.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "X28 {" +
"yField_s=" + this.yField_s + ", " +
"yField_c=" + this.yField_c +
'}';
}
}
/*********************** Builder Implementation of X28 ***********************/
class X28BuilderImpl implements X28.X28Builder {
protected Y28.Y28Builder yField_s;
protected Y28.Y28Builder yField_c;
public X28BuilderImpl() {
}
@Override
@RosettaAttribute("yField_s")
public Y28.Y28Builder getYField_s() {
return yField_s;
}
@Override
public Y28.Y28Builder getOrCreateYField_s() {
Y28.Y28Builder result;
if (yField_s!=null) {
result = yField_s;
}
else {
result = yField_s = Y28.builder();
}
return result;
}
@Override
@RosettaAttribute("yField_c")
public Y28.Y28Builder getYField_c() {
return yField_c;
}
@Override
public Y28.Y28Builder getOrCreateYField_c() {
Y28.Y28Builder result;
if (yField_c!=null) {
result = yField_c;
}
else {
result = yField_c = Y28.builder();
}
return result;
}
@Override
@RosettaAttribute("yField_s")
public X28.X28Builder setYField_s(Y28 yField_s) {
this.yField_s = yField_s==null?null:yField_s.toBuilder();
return this;
}
@Override
@RosettaAttribute("yField_c")
public X28.X28Builder setYField_c(Y28 yField_c) {
this.yField_c = yField_c==null?null:yField_c.toBuilder();
return this;
}
@Override
public X28 build() {
return new X28.X28Impl(this);
}
@Override
public X28.X28Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public X28.X28Builder prune() {
if (yField_s!=null && !yField_s.prune().hasData()) yField_s = null;
if (yField_c!=null && !yField_c.prune().hasData()) yField_c = null;
return this;
}
@Override
public boolean hasData() {
if (getYField_s()!=null && getYField_s().hasData()) return true;
if (getYField_c()!=null && getYField_c().hasData()) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public X28.X28Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
X28.X28Builder o = (X28.X28Builder) other;
merger.mergeRosetta(getYField_s(), o.getYField_s(), this::setYField_s);
merger.mergeRosetta(getYField_c(), o.getYField_c(), this::setYField_c);
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;
X28 _that = getType().cast(o);
if (!Objects.equals(yField_s, _that.getYField_s())) return false;
if (!Objects.equals(yField_c, _that.getYField_c())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (yField_s != null ? yField_s.hashCode() : 0);
_result = 31 * _result + (yField_c != null ? yField_c.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "X28Builder {" +
"yField_s=" + this.yField_s + ", " +
"yField_c=" + this.yField_c +
'}';
}
}
}