com.rosetta.testconditional.model.V6 Maven / Gradle / Ivy
The newest version!
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.V6;
import com.rosetta.testconditional.model.V6.V6Builder;
import com.rosetta.testconditional.model.V6.V6BuilderImpl;
import com.rosetta.testconditional.model.V6.V6Impl;
import com.rosetta.testconditional.model.W6;
import com.rosetta.testconditional.model.W6.W6Builder;
import com.rosetta.testconditional.model.meta.V6Meta;
import java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="V6", builder=V6.V6BuilderImpl.class, version="test")
public interface V6 extends RosettaModelObject {
V6Meta metaData = new V6Meta();
/*********************** Getter Methods ***********************/
W6 getWField();
String getXField();
/*********************** Build Methods ***********************/
V6 build();
V6.V6Builder toBuilder();
static V6.V6Builder builder() {
return new V6.V6BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends V6> metaData() {
return metaData;
}
@Override
default Class extends V6> getType() {
return V6.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processRosetta(path.newSubPath("wField"), processor, W6.class, getWField());
processor.processBasic(path.newSubPath("xField"), String.class, getXField(), this);
}
/*********************** Builder Interface ***********************/
interface V6Builder extends V6, RosettaModelObjectBuilder {
W6.W6Builder getOrCreateWField();
@Override
W6.W6Builder getWField();
V6.V6Builder setWField(W6 wField);
V6.V6Builder setXField(String xField);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processRosetta(path.newSubPath("wField"), processor, W6.W6Builder.class, getWField());
processor.processBasic(path.newSubPath("xField"), String.class, getXField(), this);
}
V6.V6Builder prune();
}
/*********************** Immutable Implementation of V6 ***********************/
class V6Impl implements V6 {
private final W6 wField;
private final String xField;
protected V6Impl(V6.V6Builder builder) {
this.wField = ofNullable(builder.getWField()).map(f->f.build()).orElse(null);
this.xField = builder.getXField();
}
@Override
@RosettaAttribute("wField")
public W6 getWField() {
return wField;
}
@Override
@RosettaAttribute("xField")
public String getXField() {
return xField;
}
@Override
public V6 build() {
return this;
}
@Override
public V6.V6Builder toBuilder() {
V6.V6Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(V6.V6Builder builder) {
ofNullable(getWField()).ifPresent(builder::setWField);
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;
V6 _that = getType().cast(o);
if (!Objects.equals(wField, _that.getWField())) return false;
if (!Objects.equals(xField, _that.getXField())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (wField != null ? wField.hashCode() : 0);
_result = 31 * _result + (xField != null ? xField.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "V6 {" +
"wField=" + this.wField + ", " +
"xField=" + this.xField +
'}';
}
}
/*********************** Builder Implementation of V6 ***********************/
class V6BuilderImpl implements V6.V6Builder {
protected W6.W6Builder wField;
protected String xField;
@Override
@RosettaAttribute("wField")
public W6.W6Builder getWField() {
return wField;
}
@Override
public W6.W6Builder getOrCreateWField() {
W6.W6Builder result;
if (wField!=null) {
result = wField;
}
else {
result = wField = W6.builder();
}
return result;
}
@Override
@RosettaAttribute("xField")
public String getXField() {
return xField;
}
@Override
@RosettaAttribute("wField")
public V6.V6Builder setWField(W6 _wField) {
this.wField = _wField == null ? null : _wField.toBuilder();
return this;
}
@Override
@RosettaAttribute("xField")
public V6.V6Builder setXField(String _xField) {
this.xField = _xField == null ? null : _xField;
return this;
}
@Override
public V6 build() {
return new V6.V6Impl(this);
}
@Override
public V6.V6Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public V6.V6Builder prune() {
if (wField!=null && !wField.prune().hasData()) wField = null;
return this;
}
@Override
public boolean hasData() {
if (getWField()!=null && getWField().hasData()) return true;
if (getXField()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public V6.V6Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
V6.V6Builder o = (V6.V6Builder) other;
merger.mergeRosetta(getWField(), o.getWField(), this::setWField);
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;
V6 _that = getType().cast(o);
if (!Objects.equals(wField, _that.getWField())) return false;
if (!Objects.equals(xField, _that.getXField())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (wField != null ? wField.hashCode() : 0);
_result = 31 * _result + (xField != null ? xField.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "V6Builder {" +
"wField=" + this.wField + ", " +
"xField=" + this.xField +
'}';
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy