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