com.rosetta.mappingprocessortest.model.Y10a Maven / Gradle / Ivy
package com.rosetta.mappingprocessortest.model;
import com.rosetta.mappingprocessortest.model.Y10a;
import com.rosetta.mappingprocessortest.model.Y10a.Y10aBuilder;
import com.rosetta.mappingprocessortest.model.Y10a.Y10aBuilderImpl;
import com.rosetta.mappingprocessortest.model.Y10a.Y10aImpl;
import com.rosetta.mappingprocessortest.model.meta.Y10aMeta;
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="Y10a", builder=Y10a.Y10aBuilderImpl.class, version="test")
public interface Y10a extends RosettaModelObject {
Y10aMeta metaData = new Y10aMeta();
/*********************** Getter Methods ***********************/
String getStrField();
/*********************** Build Methods ***********************/
Y10a build();
Y10a.Y10aBuilder toBuilder();
static Y10a.Y10aBuilder builder() {
return new Y10a.Y10aBuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends Y10a> metaData() {
return metaData;
}
@Override
default Class extends Y10a> getType() {
return Y10a.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processor.processBasic(path.newSubPath("strField"), String.class, getStrField(), this);
}
/*********************** Builder Interface ***********************/
interface Y10aBuilder extends Y10a, RosettaModelObjectBuilder {
Y10a.Y10aBuilder setStrField(String strField);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processor.processBasic(path.newSubPath("strField"), String.class, getStrField(), this);
}
Y10a.Y10aBuilder prune();
}
/*********************** Immutable Implementation of Y10a ***********************/
class Y10aImpl implements Y10a {
private final String strField;
protected Y10aImpl(Y10a.Y10aBuilder builder) {
this.strField = builder.getStrField();
}
@Override
@RosettaAttribute("strField")
public String getStrField() {
return strField;
}
@Override
public Y10a build() {
return this;
}
@Override
public Y10a.Y10aBuilder toBuilder() {
Y10a.Y10aBuilder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(Y10a.Y10aBuilder 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;
Y10a _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 "Y10a {" +
"strField=" + this.strField +
'}';
}
}
/*********************** Builder Implementation of Y10a ***********************/
class Y10aBuilderImpl implements Y10a.Y10aBuilder {
protected String strField;
public Y10aBuilderImpl() {
}
@Override
@RosettaAttribute("strField")
public String getStrField() {
return strField;
}
@Override
@RosettaAttribute("strField")
public Y10a.Y10aBuilder setStrField(String strField) {
this.strField = strField==null?null:strField;
return this;
}
@Override
public Y10a build() {
return new Y10a.Y10aImpl(this);
}
@Override
public Y10a.Y10aBuilder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public Y10a.Y10aBuilder prune() {
return this;
}
@Override
public boolean hasData() {
if (getStrField()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public Y10a.Y10aBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
Y10a.Y10aBuilder o = (Y10a.Y10aBuilder) 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;
Y10a _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 "Y10aBuilder {" +
"strField=" + this.strField +
'}';
}
}
}