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