All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.rosetta.teststruct.model.StructB11 Maven / Gradle / Ivy
package com.rosetta.teststruct.model;
import com.rosetta.model.lib.GlobalKey;
import com.rosetta.model.lib.GlobalKey.GlobalKeyBuilder;
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.model.metafields.MetaFields;
import com.rosetta.teststruct.model.StructB11;
import com.rosetta.teststruct.model.StructB11.StructB11Builder;
import com.rosetta.teststruct.model.StructB11.StructB11BuilderImpl;
import com.rosetta.teststruct.model.StructB11.StructB11Impl;
import com.rosetta.teststruct.model.meta.StructB11Meta;
import java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="StructB11", builder=StructB11.StructB11BuilderImpl.class, version="test")
public interface StructB11 extends RosettaModelObject, GlobalKey {
StructB11Meta metaData = new StructB11Meta();
/*********************** Getter Methods ***********************/
String getDField();
MetaFields getMeta();
/*********************** Build Methods ***********************/
StructB11 build();
StructB11.StructB11Builder toBuilder();
static StructB11.StructB11Builder builder() {
return new StructB11.StructB11BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends StructB11> metaData() {
return metaData;
}
@Override
default Class extends StructB11> getType() {
return StructB11.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processor.processBasic(path.newSubPath("dField"), String.class, getDField(), this);
processRosetta(path.newSubPath("meta"), processor, MetaFields.class, getMeta());
}
/*********************** Builder Interface ***********************/
interface StructB11Builder extends StructB11, RosettaModelObjectBuilder {
MetaFields.MetaFieldsBuilder getOrCreateMeta();
MetaFields.MetaFieldsBuilder getMeta();
StructB11.StructB11Builder setDField(String dField);
StructB11.StructB11Builder setMeta(MetaFields meta);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processor.processBasic(path.newSubPath("dField"), String.class, getDField(), this);
processRosetta(path.newSubPath("meta"), processor, MetaFields.MetaFieldsBuilder.class, getMeta());
}
StructB11.StructB11Builder prune();
}
/*********************** Immutable Implementation of StructB11 ***********************/
class StructB11Impl implements StructB11 {
private final String dField;
private final MetaFields meta;
protected StructB11Impl(StructB11.StructB11Builder builder) {
this.dField = builder.getDField();
this.meta = ofNullable(builder.getMeta()).map(f->f.build()).orElse(null);
}
@Override
@RosettaAttribute("dField")
public String getDField() {
return dField;
}
@Override
@RosettaAttribute("meta")
public MetaFields getMeta() {
return meta;
}
@Override
public StructB11 build() {
return this;
}
@Override
public StructB11.StructB11Builder toBuilder() {
StructB11.StructB11Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(StructB11.StructB11Builder builder) {
ofNullable(getDField()).ifPresent(builder::setDField);
ofNullable(getMeta()).ifPresent(builder::setMeta);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
StructB11 _that = getType().cast(o);
if (!Objects.equals(dField, _that.getDField())) return false;
if (!Objects.equals(meta, _that.getMeta())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (dField != null ? dField.hashCode() : 0);
_result = 31 * _result + (meta != null ? meta.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "StructB11 {" +
"dField=" + this.dField + ", " +
"meta=" + this.meta +
'}';
}
}
/*********************** Builder Implementation of StructB11 ***********************/
class StructB11BuilderImpl implements StructB11.StructB11Builder, GlobalKeyBuilder {
protected String dField;
protected MetaFields.MetaFieldsBuilder meta;
public StructB11BuilderImpl() {
}
@Override
@RosettaAttribute("dField")
public String getDField() {
return dField;
}
@Override
@RosettaAttribute("meta")
public MetaFields.MetaFieldsBuilder getMeta() {
return meta;
}
@Override
public MetaFields.MetaFieldsBuilder getOrCreateMeta() {
MetaFields.MetaFieldsBuilder result;
if (meta!=null) {
result = meta;
}
else {
result = meta = MetaFields.builder();
}
return result;
}
@Override
@RosettaAttribute("dField")
public StructB11.StructB11Builder setDField(String dField) {
this.dField = dField==null?null:dField;
return this;
}
@Override
@RosettaAttribute("meta")
public StructB11.StructB11Builder setMeta(MetaFields meta) {
this.meta = meta==null?null:meta.toBuilder();
return this;
}
@Override
public StructB11 build() {
return new StructB11.StructB11Impl(this);
}
@Override
public StructB11.StructB11Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public StructB11.StructB11Builder prune() {
if (meta!=null && !meta.prune().hasData()) meta = null;
return this;
}
@Override
public boolean hasData() {
if (getDField()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public StructB11.StructB11Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
StructB11.StructB11Builder o = (StructB11.StructB11Builder) other;
merger.mergeRosetta(getMeta(), o.getMeta(), this::setMeta);
merger.mergeBasic(getDField(), o.getDField(), this::setDField);
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;
StructB11 _that = getType().cast(o);
if (!Objects.equals(dField, _that.getDField())) return false;
if (!Objects.equals(meta, _that.getMeta())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (dField != null ? dField.hashCode() : 0);
_result = 31 * _result + (meta != null ? meta.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "StructB11Builder {" +
"dField=" + this.dField + ", " +
"meta=" + this.meta +
'}';
}
}
}