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