com.rosetta.testother.model.A6 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.A6;
import com.rosetta.testother.model.A6.A6Builder;
import com.rosetta.testother.model.A6.A6BuilderImpl;
import com.rosetta.testother.model.A6.A6Impl;
import com.rosetta.testother.model.meta.A6Meta;
import java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="A6", builder=A6.A6BuilderImpl.class, version="test")
public interface A6 extends RosettaModelObject {
A6Meta metaData = new A6Meta();
/*********************** Getter Methods ***********************/
String getBField();
String getCField();
/*********************** Build Methods ***********************/
A6 build();
A6.A6Builder toBuilder();
static A6.A6Builder builder() {
return new A6.A6BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends A6> metaData() {
return metaData;
}
@Override
default Class extends A6> getType() {
return A6.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 A6Builder extends A6, RosettaModelObjectBuilder {
A6.A6Builder setBField(String bField);
A6.A6Builder 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);
}
A6.A6Builder prune();
}
/*********************** Immutable Implementation of A6 ***********************/
class A6Impl implements A6 {
private final String bField;
private final String cField;
protected A6Impl(A6.A6Builder 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 A6 build() {
return this;
}
@Override
public A6.A6Builder toBuilder() {
A6.A6Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(A6.A6Builder 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;
A6 _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 "A6 {" +
"bField=" + this.bField + ", " +
"cField=" + this.cField +
'}';
}
}
/*********************** Builder Implementation of A6 ***********************/
class A6BuilderImpl implements A6.A6Builder {
protected String bField;
protected String cField;
public A6BuilderImpl() {
}
@Override
@RosettaAttribute("bField")
public String getBField() {
return bField;
}
@Override
@RosettaAttribute("cField")
public String getCField() {
return cField;
}
@Override
@RosettaAttribute("bField")
public A6.A6Builder setBField(String bField) {
this.bField = bField==null?null:bField;
return this;
}
@Override
@RosettaAttribute("cField")
public A6.A6Builder setCField(String cField) {
this.cField = cField==null?null:cField;
return this;
}
@Override
public A6 build() {
return new A6.A6Impl(this);
}
@Override
public A6.A6Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public A6.A6Builder prune() {
return this;
}
@Override
public boolean hasData() {
if (getBField()!=null) return true;
if (getCField()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public A6.A6Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
A6.A6Builder o = (A6.A6Builder) 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;
A6 _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 "A6Builder {" +
"bField=" + this.bField + ", " +
"cField=" + this.cField +
'}';
}
}
}