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