com.rosetta.testconditional.model.V10_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.V10_2;
import com.rosetta.testconditional.model.V10_2.V10_2Builder;
import com.rosetta.testconditional.model.V10_2.V10_2BuilderImpl;
import com.rosetta.testconditional.model.V10_2.V10_2Impl;
import com.rosetta.testconditional.model.W10_2;
import com.rosetta.testconditional.model.meta.V10_2Meta;
import java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="V10_2", builder=V10_2.V10_2BuilderImpl.class, version="test")
public interface V10_2 extends RosettaModelObject {
V10_2Meta metaData = new V10_2Meta();
/*********************** Getter Methods ***********************/
W10_2 getWField();
/*********************** Build Methods ***********************/
V10_2 build();
V10_2.V10_2Builder toBuilder();
static V10_2.V10_2Builder builder() {
return new V10_2.V10_2BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends V10_2> metaData() {
return metaData;
}
@Override
default Class extends V10_2> getType() {
return V10_2.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processRosetta(path.newSubPath("wField"), processor, W10_2.class, getWField());
}
/*********************** Builder Interface ***********************/
interface V10_2Builder extends V10_2, RosettaModelObjectBuilder {
W10_2.W10_2Builder getOrCreateWField();
W10_2.W10_2Builder getWField();
V10_2.V10_2Builder setWField(W10_2 wField);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processRosetta(path.newSubPath("wField"), processor, W10_2.W10_2Builder.class, getWField());
}
V10_2.V10_2Builder prune();
}
/*********************** Immutable Implementation of V10_2 ***********************/
class V10_2Impl implements V10_2 {
private final W10_2 wField;
protected V10_2Impl(V10_2.V10_2Builder builder) {
this.wField = ofNullable(builder.getWField()).map(f->f.build()).orElse(null);
}
@Override
@RosettaAttribute("wField")
public W10_2 getWField() {
return wField;
}
@Override
public V10_2 build() {
return this;
}
@Override
public V10_2.V10_2Builder toBuilder() {
V10_2.V10_2Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(V10_2.V10_2Builder builder) {
ofNullable(getWField()).ifPresent(builder::setWField);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
V10_2 _that = getType().cast(o);
if (!Objects.equals(wField, _that.getWField())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (wField != null ? wField.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "V10_2 {" +
"wField=" + this.wField +
'}';
}
}
/*********************** Builder Implementation of V10_2 ***********************/
class V10_2BuilderImpl implements V10_2.V10_2Builder {
protected W10_2.W10_2Builder wField;
public V10_2BuilderImpl() {
}
@Override
@RosettaAttribute("wField")
public W10_2.W10_2Builder getWField() {
return wField;
}
@Override
public W10_2.W10_2Builder getOrCreateWField() {
W10_2.W10_2Builder result;
if (wField!=null) {
result = wField;
}
else {
result = wField = W10_2.builder();
}
return result;
}
@Override
@RosettaAttribute("wField")
public V10_2.V10_2Builder setWField(W10_2 wField) {
this.wField = wField==null?null:wField.toBuilder();
return this;
}
@Override
public V10_2 build() {
return new V10_2.V10_2Impl(this);
}
@Override
public V10_2.V10_2Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public V10_2.V10_2Builder prune() {
if (wField!=null && !wField.prune().hasData()) wField = null;
return this;
}
@Override
public boolean hasData() {
if (getWField()!=null && getWField().hasData()) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public V10_2.V10_2Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
V10_2.V10_2Builder o = (V10_2.V10_2Builder) other;
merger.mergeRosetta(getWField(), o.getWField(), this::setWField);
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;
V10_2 _that = getType().cast(o);
if (!Objects.equals(wField, _that.getWField())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (wField != null ? wField.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "V10_2Builder {" +
"wField=" + this.wField +
'}';
}
}
}