com.rosetta.testcard.model.Y8_1 Maven / Gradle / Ivy
package com.rosetta.testcard.model;
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 com.rosetta.testcard.model.Y8_1;
import com.rosetta.testcard.model.Y8_1.Y8_1Builder;
import com.rosetta.testcard.model.Y8_1.Y8_1BuilderImpl;
import com.rosetta.testcard.model.Y8_1.Y8_1Impl;
import com.rosetta.testcard.model.meta.Y8_1Meta;
import java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="Y8_1", builder=Y8_1.Y8_1BuilderImpl.class, version="test")
public interface Y8_1 extends RosettaModelObject {
Y8_1Meta metaData = new Y8_1Meta();
/*********************** Getter Methods ***********************/
String getZField();
/*********************** Build Methods ***********************/
Y8_1 build();
Y8_1.Y8_1Builder toBuilder();
static Y8_1.Y8_1Builder builder() {
return new Y8_1.Y8_1BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends Y8_1> metaData() {
return metaData;
}
@Override
default Class extends Y8_1> getType() {
return Y8_1.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processor.processBasic(path.newSubPath("zField"), String.class, getZField(), this);
}
/*********************** Builder Interface ***********************/
interface Y8_1Builder extends Y8_1, RosettaModelObjectBuilder {
Y8_1.Y8_1Builder setZField(String zField);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processor.processBasic(path.newSubPath("zField"), String.class, getZField(), this);
}
Y8_1.Y8_1Builder prune();
}
/*********************** Immutable Implementation of Y8_1 ***********************/
class Y8_1Impl implements Y8_1 {
private final String zField;
protected Y8_1Impl(Y8_1.Y8_1Builder builder) {
this.zField = builder.getZField();
}
@Override
@RosettaAttribute("zField")
public String getZField() {
return zField;
}
@Override
public Y8_1 build() {
return this;
}
@Override
public Y8_1.Y8_1Builder toBuilder() {
Y8_1.Y8_1Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(Y8_1.Y8_1Builder builder) {
ofNullable(getZField()).ifPresent(builder::setZField);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
Y8_1 _that = getType().cast(o);
if (!Objects.equals(zField, _that.getZField())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (zField != null ? zField.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "Y8_1 {" +
"zField=" + this.zField +
'}';
}
}
/*********************** Builder Implementation of Y8_1 ***********************/
class Y8_1BuilderImpl implements Y8_1.Y8_1Builder {
protected String zField;
public Y8_1BuilderImpl() {
}
@Override
@RosettaAttribute("zField")
public String getZField() {
return zField;
}
@Override
@RosettaAttribute("zField")
public Y8_1.Y8_1Builder setZField(String zField) {
this.zField = zField==null?null:zField;
return this;
}
@Override
public Y8_1 build() {
return new Y8_1.Y8_1Impl(this);
}
@Override
public Y8_1.Y8_1Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public Y8_1.Y8_1Builder prune() {
return this;
}
@Override
public boolean hasData() {
if (getZField()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public Y8_1.Y8_1Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
Y8_1.Y8_1Builder o = (Y8_1.Y8_1Builder) other;
merger.mergeBasic(getZField(), o.getZField(), this::setZField);
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;
Y8_1 _that = getType().cast(o);
if (!Objects.equals(zField, _that.getZField())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (zField != null ? zField.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "Y8_1Builder {" +
"zField=" + this.zField +
'}';
}
}
}