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