com.rosetta.testconditional.model.Top26_5 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.Top26_5;
import com.rosetta.testconditional.model.Top26_5.Top26_5Builder;
import com.rosetta.testconditional.model.Top26_5.Top26_5BuilderImpl;
import com.rosetta.testconditional.model.Top26_5.Top26_5Impl;
import com.rosetta.testconditional.model.X26_5;
import com.rosetta.testconditional.model.meta.Top26_5Meta;
import java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="Top26_5", builder=Top26_5.Top26_5BuilderImpl.class, version="test")
public interface Top26_5 extends RosettaModelObject {
Top26_5Meta metaData = new Top26_5Meta();
/*********************** Getter Methods ***********************/
X26_5 getXField();
/*********************** Build Methods ***********************/
Top26_5 build();
Top26_5.Top26_5Builder toBuilder();
static Top26_5.Top26_5Builder builder() {
return new Top26_5.Top26_5BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends Top26_5> metaData() {
return metaData;
}
@Override
default Class extends Top26_5> getType() {
return Top26_5.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processRosetta(path.newSubPath("xField"), processor, X26_5.class, getXField());
}
/*********************** Builder Interface ***********************/
interface Top26_5Builder extends Top26_5, RosettaModelObjectBuilder {
X26_5.X26_5Builder getOrCreateXField();
X26_5.X26_5Builder getXField();
Top26_5.Top26_5Builder setXField(X26_5 xField);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processRosetta(path.newSubPath("xField"), processor, X26_5.X26_5Builder.class, getXField());
}
Top26_5.Top26_5Builder prune();
}
/*********************** Immutable Implementation of Top26_5 ***********************/
class Top26_5Impl implements Top26_5 {
private final X26_5 xField;
protected Top26_5Impl(Top26_5.Top26_5Builder builder) {
this.xField = ofNullable(builder.getXField()).map(f->f.build()).orElse(null);
}
@Override
@RosettaAttribute("xField")
public X26_5 getXField() {
return xField;
}
@Override
public Top26_5 build() {
return this;
}
@Override
public Top26_5.Top26_5Builder toBuilder() {
Top26_5.Top26_5Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(Top26_5.Top26_5Builder 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;
Top26_5 _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 "Top26_5 {" +
"xField=" + this.xField +
'}';
}
}
/*********************** Builder Implementation of Top26_5 ***********************/
class Top26_5BuilderImpl implements Top26_5.Top26_5Builder {
protected X26_5.X26_5Builder xField;
public Top26_5BuilderImpl() {
}
@Override
@RosettaAttribute("xField")
public X26_5.X26_5Builder getXField() {
return xField;
}
@Override
public X26_5.X26_5Builder getOrCreateXField() {
X26_5.X26_5Builder result;
if (xField!=null) {
result = xField;
}
else {
result = xField = X26_5.builder();
}
return result;
}
@Override
@RosettaAttribute("xField")
public Top26_5.Top26_5Builder setXField(X26_5 xField) {
this.xField = xField==null?null:xField.toBuilder();
return this;
}
@Override
public Top26_5 build() {
return new Top26_5.Top26_5Impl(this);
}
@Override
public Top26_5.Top26_5Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public Top26_5.Top26_5Builder 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 Top26_5.Top26_5Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
Top26_5.Top26_5Builder o = (Top26_5.Top26_5Builder) 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;
Top26_5 _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 "Top26_5Builder {" +
"xField=" + this.xField +
'}';
}
}
}