com.rosetta.testconditional.model.V2_2 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.V2_2;
import com.rosetta.testconditional.model.V2_2.V2_2Builder;
import com.rosetta.testconditional.model.V2_2.V2_2BuilderImpl;
import com.rosetta.testconditional.model.V2_2.V2_2Impl;
import com.rosetta.testconditional.model.W2_2;
import com.rosetta.testconditional.model.X2_2;
import com.rosetta.testconditional.model.meta.V2_2Meta;
import java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="V2_2", builder=V2_2.V2_2BuilderImpl.class, version="test")
public interface V2_2 extends RosettaModelObject {
V2_2Meta metaData = new V2_2Meta();
/*********************** Getter Methods ***********************/
W2_2 getWField();
X2_2 getXField();
/*********************** Build Methods ***********************/
V2_2 build();
V2_2.V2_2Builder toBuilder();
static V2_2.V2_2Builder builder() {
return new V2_2.V2_2BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends V2_2> metaData() {
return metaData;
}
@Override
default Class extends V2_2> getType() {
return V2_2.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processRosetta(path.newSubPath("wField"), processor, W2_2.class, getWField());
processRosetta(path.newSubPath("xField"), processor, X2_2.class, getXField());
}
/*********************** Builder Interface ***********************/
interface V2_2Builder extends V2_2, RosettaModelObjectBuilder {
W2_2.W2_2Builder getOrCreateWField();
W2_2.W2_2Builder getWField();
X2_2.X2_2Builder getOrCreateXField();
X2_2.X2_2Builder getXField();
V2_2.V2_2Builder setWField(W2_2 wField);
V2_2.V2_2Builder setXField(X2_2 xField);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processRosetta(path.newSubPath("wField"), processor, W2_2.W2_2Builder.class, getWField());
processRosetta(path.newSubPath("xField"), processor, X2_2.X2_2Builder.class, getXField());
}
V2_2.V2_2Builder prune();
}
/*********************** Immutable Implementation of V2_2 ***********************/
class V2_2Impl implements V2_2 {
private final W2_2 wField;
private final X2_2 xField;
protected V2_2Impl(V2_2.V2_2Builder builder) {
this.wField = ofNullable(builder.getWField()).map(f->f.build()).orElse(null);
this.xField = ofNullable(builder.getXField()).map(f->f.build()).orElse(null);
}
@Override
@RosettaAttribute("wField")
public W2_2 getWField() {
return wField;
}
@Override
@RosettaAttribute("xField")
public X2_2 getXField() {
return xField;
}
@Override
public V2_2 build() {
return this;
}
@Override
public V2_2.V2_2Builder toBuilder() {
V2_2.V2_2Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(V2_2.V2_2Builder 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;
V2_2 _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 "V2_2 {" +
"wField=" + this.wField + ", " +
"xField=" + this.xField +
'}';
}
}
/*********************** Builder Implementation of V2_2 ***********************/
class V2_2BuilderImpl implements V2_2.V2_2Builder {
protected W2_2.W2_2Builder wField;
protected X2_2.X2_2Builder xField;
public V2_2BuilderImpl() {
}
@Override
@RosettaAttribute("wField")
public W2_2.W2_2Builder getWField() {
return wField;
}
@Override
public W2_2.W2_2Builder getOrCreateWField() {
W2_2.W2_2Builder result;
if (wField!=null) {
result = wField;
}
else {
result = wField = W2_2.builder();
}
return result;
}
@Override
@RosettaAttribute("xField")
public X2_2.X2_2Builder getXField() {
return xField;
}
@Override
public X2_2.X2_2Builder getOrCreateXField() {
X2_2.X2_2Builder result;
if (xField!=null) {
result = xField;
}
else {
result = xField = X2_2.builder();
}
return result;
}
@Override
@RosettaAttribute("wField")
public V2_2.V2_2Builder setWField(W2_2 wField) {
this.wField = wField==null?null:wField.toBuilder();
return this;
}
@Override
@RosettaAttribute("xField")
public V2_2.V2_2Builder setXField(X2_2 xField) {
this.xField = xField==null?null:xField.toBuilder();
return this;
}
@Override
public V2_2 build() {
return new V2_2.V2_2Impl(this);
}
@Override
public V2_2.V2_2Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public V2_2.V2_2Builder prune() {
if (wField!=null && !wField.prune().hasData()) wField = null;
if (xField!=null && !xField.prune().hasData()) xField = null;
return this;
}
@Override
public boolean hasData() {
if (getWField()!=null && getWField().hasData()) return true;
if (getXField()!=null && getXField().hasData()) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public V2_2.V2_2Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
V2_2.V2_2Builder o = (V2_2.V2_2Builder) other;
merger.mergeRosetta(getWField(), o.getWField(), this::setWField);
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;
V2_2 _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 "V2_2Builder {" +
"wField=" + this.wField + ", " +
"xField=" + this.xField +
'}';
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy