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