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