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