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