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