com.rosetta.testother.model.B7 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.B7;
import com.rosetta.testother.model.B7.B7Builder;
import com.rosetta.testother.model.B7.B7BuilderImpl;
import com.rosetta.testother.model.B7.B7Impl;
import com.rosetta.testother.model.B7_2;
import com.rosetta.testother.model.B7_2.B7_2Builder;
import com.rosetta.testother.model.B7_2.B7_2BuilderImpl;
import com.rosetta.testother.model.B7_2.B7_2Impl;
import com.rosetta.testother.model.meta.B7Meta;
import java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="B7", builder=B7.B7BuilderImpl.class, version="test")
public interface B7 extends B7_2 {
B7Meta metaData = new B7Meta();
/*********************** Getter Methods ***********************/
String getCField();
/*********************** Build Methods ***********************/
B7 build();
B7.B7Builder toBuilder();
static B7.B7Builder builder() {
return new B7.B7BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends B7> metaData() {
return metaData;
}
@Override
default Class extends B7> getType() {
return B7.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processor.processBasic(path.newSubPath("dField"), String.class, getDField(), this);
processor.processBasic(path.newSubPath("cField"), String.class, getCField(), this);
}
/*********************** Builder Interface ***********************/
interface B7Builder extends B7, B7_2.B7_2Builder {
B7.B7Builder setDField(String dField);
B7.B7Builder setCField(String cField);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processor.processBasic(path.newSubPath("dField"), String.class, getDField(), this);
processor.processBasic(path.newSubPath("cField"), String.class, getCField(), this);
}
B7.B7Builder prune();
}
/*********************** Immutable Implementation of B7 ***********************/
class B7Impl extends B7_2.B7_2Impl implements B7 {
private final String cField;
protected B7Impl(B7.B7Builder builder) {
super(builder);
this.cField = builder.getCField();
}
@Override
@RosettaAttribute("cField")
public String getCField() {
return cField;
}
@Override
public B7 build() {
return this;
}
@Override
public B7.B7Builder toBuilder() {
B7.B7Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(B7.B7Builder builder) {
super.setBuilderFields(builder);
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;
if (!super.equals(o)) return false;
B7 _that = getType().cast(o);
if (!Objects.equals(cField, _that.getCField())) return false;
return true;
}
@Override
public int hashCode() {
int _result = super.hashCode();
_result = 31 * _result + (cField != null ? cField.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "B7 {" +
"cField=" + this.cField +
'}' + " " + super.toString();
}
}
/*********************** Builder Implementation of B7 ***********************/
class B7BuilderImpl extends B7_2.B7_2BuilderImpl implements B7.B7Builder {
protected String cField;
public B7BuilderImpl() {
}
@Override
@RosettaAttribute("cField")
public String getCField() {
return cField;
}
@Override
@RosettaAttribute("dField")
public B7.B7Builder setDField(String dField) {
this.dField = dField==null?null:dField;
return this;
}
@Override
@RosettaAttribute("cField")
public B7.B7Builder setCField(String cField) {
this.cField = cField==null?null:cField;
return this;
}
@Override
public B7 build() {
return new B7.B7Impl(this);
}
@Override
public B7.B7Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public B7.B7Builder prune() {
super.prune();
return this;
}
@Override
public boolean hasData() {
if (super.hasData()) return true;
if (getCField()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public B7.B7Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
super.merge(other, merger);
B7.B7Builder o = (B7.B7Builder) other;
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;
if (!super.equals(o)) return false;
B7 _that = getType().cast(o);
if (!Objects.equals(cField, _that.getCField())) return false;
return true;
}
@Override
public int hashCode() {
int _result = super.hashCode();
_result = 31 * _result + (cField != null ? cField.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "B7Builder {" +
"cField=" + this.cField +
'}' + " " + super.toString();
}
}
}