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