com.rosetta.testconditional.model.X2_2 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_2;
import com.rosetta.testconditional.model.X2_2.X2_2Builder;
import com.rosetta.testconditional.model.X2_2.X2_2BuilderImpl;
import com.rosetta.testconditional.model.X2_2.X2_2Impl;
import com.rosetta.testconditional.model.meta.X2_2Meta;
import java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="X2_2", builder=X2_2.X2_2BuilderImpl.class, version="test")
public interface X2_2 extends RosettaModelObject {
X2_2Meta metaData = new X2_2Meta();
/*********************** Getter Methods ***********************/
String getSetToField();
/*********************** Build Methods ***********************/
X2_2 build();
X2_2.X2_2Builder toBuilder();
static X2_2.X2_2Builder builder() {
return new X2_2.X2_2BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends X2_2> metaData() {
return metaData;
}
@Override
default Class extends X2_2> getType() {
return X2_2.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processor.processBasic(path.newSubPath("setToField"), String.class, getSetToField(), this);
}
/*********************** Builder Interface ***********************/
interface X2_2Builder extends X2_2, RosettaModelObjectBuilder {
X2_2.X2_2Builder setSetToField(String setToField);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processor.processBasic(path.newSubPath("setToField"), String.class, getSetToField(), this);
}
X2_2.X2_2Builder prune();
}
/*********************** Immutable Implementation of X2_2 ***********************/
class X2_2Impl implements X2_2 {
private final String setToField;
protected X2_2Impl(X2_2.X2_2Builder builder) {
this.setToField = builder.getSetToField();
}
@Override
@RosettaAttribute("setToField")
public String getSetToField() {
return setToField;
}
@Override
public X2_2 build() {
return this;
}
@Override
public X2_2.X2_2Builder toBuilder() {
X2_2.X2_2Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(X2_2.X2_2Builder 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_2 _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_2 {" +
"setToField=" + this.setToField +
'}';
}
}
/*********************** Builder Implementation of X2_2 ***********************/
class X2_2BuilderImpl implements X2_2.X2_2Builder {
protected String setToField;
public X2_2BuilderImpl() {
}
@Override
@RosettaAttribute("setToField")
public String getSetToField() {
return setToField;
}
@Override
@RosettaAttribute("setToField")
public X2_2.X2_2Builder setSetToField(String setToField) {
this.setToField = setToField==null?null:setToField;
return this;
}
@Override
public X2_2 build() {
return new X2_2.X2_2Impl(this);
}
@Override
public X2_2.X2_2Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public X2_2.X2_2Builder prune() {
return this;
}
@Override
public boolean hasData() {
if (getSetToField()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public X2_2.X2_2Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
X2_2.X2_2Builder o = (X2_2.X2_2Builder) 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_2 _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_2Builder {" +
"setToField=" + this.setToField +
'}';
}
}
}