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