com.rosetta.testconditional.model.Top24b 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.Top24b;
import com.rosetta.testconditional.model.Top24b.Top24bBuilder;
import com.rosetta.testconditional.model.Top24b.Top24bBuilderImpl;
import com.rosetta.testconditional.model.Top24b.Top24bImpl;
import com.rosetta.testconditional.model.V24b;
import com.rosetta.testconditional.model.meta.Top24bMeta;
import java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="Top24b", builder=Top24b.Top24bBuilderImpl.class, version="test")
public interface Top24b extends RosettaModelObject {
Top24bMeta metaData = new Top24bMeta();
/*********************** Getter Methods ***********************/
V24b getVField();
/*********************** Build Methods ***********************/
Top24b build();
Top24b.Top24bBuilder toBuilder();
static Top24b.Top24bBuilder builder() {
return new Top24b.Top24bBuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends Top24b> metaData() {
return metaData;
}
@Override
default Class extends Top24b> getType() {
return Top24b.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processRosetta(path.newSubPath("vField"), processor, V24b.class, getVField());
}
/*********************** Builder Interface ***********************/
interface Top24bBuilder extends Top24b, RosettaModelObjectBuilder {
V24b.V24bBuilder getOrCreateVField();
V24b.V24bBuilder getVField();
Top24b.Top24bBuilder setVField(V24b vField);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processRosetta(path.newSubPath("vField"), processor, V24b.V24bBuilder.class, getVField());
}
Top24b.Top24bBuilder prune();
}
/*********************** Immutable Implementation of Top24b ***********************/
class Top24bImpl implements Top24b {
private final V24b vField;
protected Top24bImpl(Top24b.Top24bBuilder builder) {
this.vField = ofNullable(builder.getVField()).map(f->f.build()).orElse(null);
}
@Override
@RosettaAttribute("vField")
public V24b getVField() {
return vField;
}
@Override
public Top24b build() {
return this;
}
@Override
public Top24b.Top24bBuilder toBuilder() {
Top24b.Top24bBuilder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(Top24b.Top24bBuilder 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;
Top24b _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 "Top24b {" +
"vField=" + this.vField +
'}';
}
}
/*********************** Builder Implementation of Top24b ***********************/
class Top24bBuilderImpl implements Top24b.Top24bBuilder {
protected V24b.V24bBuilder vField;
public Top24bBuilderImpl() {
}
@Override
@RosettaAttribute("vField")
public V24b.V24bBuilder getVField() {
return vField;
}
@Override
public V24b.V24bBuilder getOrCreateVField() {
V24b.V24bBuilder result;
if (vField!=null) {
result = vField;
}
else {
result = vField = V24b.builder();
}
return result;
}
@Override
@RosettaAttribute("vField")
public Top24b.Top24bBuilder setVField(V24b vField) {
this.vField = vField==null?null:vField.toBuilder();
return this;
}
@Override
public Top24b build() {
return new Top24b.Top24bImpl(this);
}
@Override
public Top24b.Top24bBuilder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public Top24b.Top24bBuilder 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 Top24b.Top24bBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
Top24b.Top24bBuilder o = (Top24b.Top24bBuilder) 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;
Top24b _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 "Top24bBuilder {" +
"vField=" + this.vField +
'}';
}
}
}