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