com.rosetta.externalsynonym.model.X8 Maven / Gradle / Ivy
package com.rosetta.externalsynonym.model;
import com.rosetta.externalsynonym.model.Super8;
import com.rosetta.externalsynonym.model.Super8.Super8Builder;
import com.rosetta.externalsynonym.model.Super8.Super8BuilderImpl;
import com.rosetta.externalsynonym.model.Super8.Super8Impl;
import com.rosetta.externalsynonym.model.X8;
import com.rosetta.externalsynonym.model.X8.X8Builder;
import com.rosetta.externalsynonym.model.X8.X8BuilderImpl;
import com.rosetta.externalsynonym.model.X8.X8Impl;
import com.rosetta.externalsynonym.model.meta.X8Meta;
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="X8", builder=X8.X8BuilderImpl.class, version="test")
public interface X8 extends Super8 {
X8Meta metaData = new X8Meta();
/*********************** Getter Methods ***********************/
String getXxField();
/*********************** Build Methods ***********************/
X8 build();
X8.X8Builder toBuilder();
static X8.X8Builder builder() {
return new X8.X8BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends X8> metaData() {
return metaData;
}
@Override
default Class extends X8> getType() {
return X8.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processor.processBasic(path.newSubPath("superField"), String.class, getSuperField(), this);
processor.processBasic(path.newSubPath("xxField"), String.class, getXxField(), this);
}
/*********************** Builder Interface ***********************/
interface X8Builder extends X8, Super8.Super8Builder {
X8.X8Builder setSuperField(String superField);
X8.X8Builder setXxField(String xxField);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processor.processBasic(path.newSubPath("superField"), String.class, getSuperField(), this);
processor.processBasic(path.newSubPath("xxField"), String.class, getXxField(), this);
}
X8.X8Builder prune();
}
/*********************** Immutable Implementation of X8 ***********************/
class X8Impl extends Super8.Super8Impl implements X8 {
private final String xxField;
protected X8Impl(X8.X8Builder builder) {
super(builder);
this.xxField = builder.getXxField();
}
@Override
@RosettaAttribute("xxField")
public String getXxField() {
return xxField;
}
@Override
public X8 build() {
return this;
}
@Override
public X8.X8Builder toBuilder() {
X8.X8Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(X8.X8Builder builder) {
super.setBuilderFields(builder);
ofNullable(getXxField()).ifPresent(builder::setXxField);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
if (!super.equals(o)) return false;
X8 _that = getType().cast(o);
if (!Objects.equals(xxField, _that.getXxField())) return false;
return true;
}
@Override
public int hashCode() {
int _result = super.hashCode();
_result = 31 * _result + (xxField != null ? xxField.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "X8 {" +
"xxField=" + this.xxField +
'}' + " " + super.toString();
}
}
/*********************** Builder Implementation of X8 ***********************/
class X8BuilderImpl extends Super8.Super8BuilderImpl implements X8.X8Builder {
protected String xxField;
public X8BuilderImpl() {
}
@Override
@RosettaAttribute("xxField")
public String getXxField() {
return xxField;
}
@Override
@RosettaAttribute("superField")
public X8.X8Builder setSuperField(String superField) {
this.superField = superField==null?null:superField;
return this;
}
@Override
@RosettaAttribute("xxField")
public X8.X8Builder setXxField(String xxField) {
this.xxField = xxField==null?null:xxField;
return this;
}
@Override
public X8 build() {
return new X8.X8Impl(this);
}
@Override
public X8.X8Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public X8.X8Builder prune() {
super.prune();
return this;
}
@Override
public boolean hasData() {
if (super.hasData()) return true;
if (getXxField()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public X8.X8Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
super.merge(other, merger);
X8.X8Builder o = (X8.X8Builder) other;
merger.mergeBasic(getXxField(), o.getXxField(), this::setXxField);
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;
if (!super.equals(o)) return false;
X8 _that = getType().cast(o);
if (!Objects.equals(xxField, _that.getXxField())) return false;
return true;
}
@Override
public int hashCode() {
int _result = super.hashCode();
_result = 31 * _result + (xxField != null ? xxField.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "X8Builder {" +
"xxField=" + this.xxField +
'}' + " " + super.toString();
}
}
}