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