com.rosetta.testconditional.model.X26_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.Test2Enum;
import com.rosetta.testconditional.model.TestEnum;
import com.rosetta.testconditional.model.X26_5;
import com.rosetta.testconditional.model.X26_5.X26_5Builder;
import com.rosetta.testconditional.model.X26_5.X26_5BuilderImpl;
import com.rosetta.testconditional.model.X26_5.X26_5Impl;
import com.rosetta.testconditional.model.meta.X26_5Meta;
import java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="X26_5", builder=X26_5.X26_5BuilderImpl.class, version="test")
public interface X26_5 extends RosettaModelObject {
X26_5Meta metaData = new X26_5Meta();
/*********************** Getter Methods ***********************/
TestEnum getYField();
Test2Enum getZField();
/*********************** Build Methods ***********************/
X26_5 build();
X26_5.X26_5Builder toBuilder();
static X26_5.X26_5Builder builder() {
return new X26_5.X26_5BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends X26_5> metaData() {
return metaData;
}
@Override
default Class extends X26_5> getType() {
return X26_5.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processor.processBasic(path.newSubPath("yField"), TestEnum.class, getYField(), this);
processor.processBasic(path.newSubPath("zField"), Test2Enum.class, getZField(), this);
}
/*********************** Builder Interface ***********************/
interface X26_5Builder extends X26_5, RosettaModelObjectBuilder {
X26_5.X26_5Builder setYField(TestEnum yField);
X26_5.X26_5Builder setZField(Test2Enum zField);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processor.processBasic(path.newSubPath("yField"), TestEnum.class, getYField(), this);
processor.processBasic(path.newSubPath("zField"), Test2Enum.class, getZField(), this);
}
X26_5.X26_5Builder prune();
}
/*********************** Immutable Implementation of X26_5 ***********************/
class X26_5Impl implements X26_5 {
private final TestEnum yField;
private final Test2Enum zField;
protected X26_5Impl(X26_5.X26_5Builder builder) {
this.yField = builder.getYField();
this.zField = builder.getZField();
}
@Override
@RosettaAttribute("yField")
public TestEnum getYField() {
return yField;
}
@Override
@RosettaAttribute("zField")
public Test2Enum getZField() {
return zField;
}
@Override
public X26_5 build() {
return this;
}
@Override
public X26_5.X26_5Builder toBuilder() {
X26_5.X26_5Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(X26_5.X26_5Builder builder) {
ofNullable(getYField()).ifPresent(builder::setYField);
ofNullable(getZField()).ifPresent(builder::setZField);
}
@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_5 _that = getType().cast(o);
if (!Objects.equals(yField, _that.getYField())) return false;
if (!Objects.equals(zField, _that.getZField())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (yField != null ? yField.getClass().getName().hashCode() : 0);
_result = 31 * _result + (zField != null ? zField.getClass().getName().hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "X26_5 {" +
"yField=" + this.yField + ", " +
"zField=" + this.zField +
'}';
}
}
/*********************** Builder Implementation of X26_5 ***********************/
class X26_5BuilderImpl implements X26_5.X26_5Builder {
protected TestEnum yField;
protected Test2Enum zField;
public X26_5BuilderImpl() {
}
@Override
@RosettaAttribute("yField")
public TestEnum getYField() {
return yField;
}
@Override
@RosettaAttribute("zField")
public Test2Enum getZField() {
return zField;
}
@Override
@RosettaAttribute("yField")
public X26_5.X26_5Builder setYField(TestEnum yField) {
this.yField = yField==null?null:yField;
return this;
}
@Override
@RosettaAttribute("zField")
public X26_5.X26_5Builder setZField(Test2Enum zField) {
this.zField = zField==null?null:zField;
return this;
}
@Override
public X26_5 build() {
return new X26_5.X26_5Impl(this);
}
@Override
public X26_5.X26_5Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public X26_5.X26_5Builder prune() {
return this;
}
@Override
public boolean hasData() {
if (getYField()!=null) return true;
if (getZField()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public X26_5.X26_5Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
X26_5.X26_5Builder o = (X26_5.X26_5Builder) other;
merger.mergeBasic(getYField(), o.getYField(), this::setYField);
merger.mergeBasic(getZField(), o.getZField(), this::setZField);
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_5 _that = getType().cast(o);
if (!Objects.equals(yField, _that.getYField())) return false;
if (!Objects.equals(zField, _that.getZField())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (yField != null ? yField.getClass().getName().hashCode() : 0);
_result = 31 * _result + (zField != null ? zField.getClass().getName().hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "X26_5Builder {" +
"yField=" + this.yField + ", " +
"zField=" + this.zField +
'}';
}
}
}