com.rosetta.mappingprocessortest.model.Y10b Maven / Gradle / Ivy
package com.rosetta.mappingprocessortest.model;
import com.rosetta.mappingprocessortest.model.Y10b;
import com.rosetta.mappingprocessortest.model.Y10b.Y10bBuilder;
import com.rosetta.mappingprocessortest.model.Y10b.Y10bBuilderImpl;
import com.rosetta.mappingprocessortest.model.Y10b.Y10bImpl;
import com.rosetta.mappingprocessortest.model.meta.Y10bMeta;
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 java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="Y10b", builder=Y10b.Y10bBuilderImpl.class, version="test")
public interface Y10b extends RosettaModelObject {
Y10bMeta metaData = new Y10bMeta();
/*********************** Getter Methods ***********************/
String getStrField();
/*********************** Build Methods ***********************/
Y10b build();
Y10b.Y10bBuilder toBuilder();
static Y10b.Y10bBuilder builder() {
return new Y10b.Y10bBuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends Y10b> metaData() {
return metaData;
}
@Override
default Class extends Y10b> getType() {
return Y10b.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processor.processBasic(path.newSubPath("strField"), String.class, getStrField(), this);
}
/*********************** Builder Interface ***********************/
interface Y10bBuilder extends Y10b, RosettaModelObjectBuilder {
Y10b.Y10bBuilder setStrField(String strField);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processor.processBasic(path.newSubPath("strField"), String.class, getStrField(), this);
}
Y10b.Y10bBuilder prune();
}
/*********************** Immutable Implementation of Y10b ***********************/
class Y10bImpl implements Y10b {
private final String strField;
protected Y10bImpl(Y10b.Y10bBuilder builder) {
this.strField = builder.getStrField();
}
@Override
@RosettaAttribute("strField")
public String getStrField() {
return strField;
}
@Override
public Y10b build() {
return this;
}
@Override
public Y10b.Y10bBuilder toBuilder() {
Y10b.Y10bBuilder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(Y10b.Y10bBuilder builder) {
ofNullable(getStrField()).ifPresent(builder::setStrField);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
Y10b _that = getType().cast(o);
if (!Objects.equals(strField, _that.getStrField())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (strField != null ? strField.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "Y10b {" +
"strField=" + this.strField +
'}';
}
}
/*********************** Builder Implementation of Y10b ***********************/
class Y10bBuilderImpl implements Y10b.Y10bBuilder {
protected String strField;
public Y10bBuilderImpl() {
}
@Override
@RosettaAttribute("strField")
public String getStrField() {
return strField;
}
@Override
@RosettaAttribute("strField")
public Y10b.Y10bBuilder setStrField(String strField) {
this.strField = strField==null?null:strField;
return this;
}
@Override
public Y10b build() {
return new Y10b.Y10bImpl(this);
}
@Override
public Y10b.Y10bBuilder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public Y10b.Y10bBuilder prune() {
return this;
}
@Override
public boolean hasData() {
if (getStrField()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public Y10b.Y10bBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
Y10b.Y10bBuilder o = (Y10b.Y10bBuilder) other;
merger.mergeBasic(getStrField(), o.getStrField(), this::setStrField);
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;
Y10b _that = getType().cast(o);
if (!Objects.equals(strField, _that.getStrField())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (strField != null ? strField.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "Y10bBuilder {" +
"strField=" + this.strField +
'}';
}
}
}