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