com.rosetta.testconditional.model.W21_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.W21_2;
import com.rosetta.testconditional.model.W21_2.W21_2Builder;
import com.rosetta.testconditional.model.W21_2.W21_2BuilderImpl;
import com.rosetta.testconditional.model.W21_2.W21_2Impl;
import com.rosetta.testconditional.model.meta.W21_2Meta;
import java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="W21_2", builder=W21_2.W21_2BuilderImpl.class, version="test")
public interface W21_2 extends RosettaModelObject {
W21_2Meta metaData = new W21_2Meta();
/*********************** Getter Methods ***********************/
String getItemName();
String getItemValue();
/*********************** Build Methods ***********************/
W21_2 build();
W21_2.W21_2Builder toBuilder();
static W21_2.W21_2Builder builder() {
return new W21_2.W21_2BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends W21_2> metaData() {
return metaData;
}
@Override
default Class extends W21_2> getType() {
return W21_2.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_2Builder extends W21_2, RosettaModelObjectBuilder {
W21_2.W21_2Builder setItemName(String itemName);
W21_2.W21_2Builder 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_2.W21_2Builder prune();
}
/*********************** Immutable Implementation of W21_2 ***********************/
class W21_2Impl implements W21_2 {
private final String itemName;
private final String itemValue;
protected W21_2Impl(W21_2.W21_2Builder 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_2 build() {
return this;
}
@Override
public W21_2.W21_2Builder toBuilder() {
W21_2.W21_2Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(W21_2.W21_2Builder 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_2 _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_2 {" +
"itemName=" + this.itemName + ", " +
"itemValue=" + this.itemValue +
'}';
}
}
/*********************** Builder Implementation of W21_2 ***********************/
class W21_2BuilderImpl implements W21_2.W21_2Builder {
protected String itemName;
protected String itemValue;
public W21_2BuilderImpl() {
}
@Override
@RosettaAttribute("itemName")
public String getItemName() {
return itemName;
}
@Override
@RosettaAttribute("itemValue")
public String getItemValue() {
return itemValue;
}
@Override
@RosettaAttribute("itemName")
public W21_2.W21_2Builder setItemName(String itemName) {
this.itemName = itemName==null?null:itemName;
return this;
}
@Override
@RosettaAttribute("itemValue")
public W21_2.W21_2Builder setItemValue(String itemValue) {
this.itemValue = itemValue==null?null:itemValue;
return this;
}
@Override
public W21_2 build() {
return new W21_2.W21_2Impl(this);
}
@Override
public W21_2.W21_2Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public W21_2.W21_2Builder prune() {
return this;
}
@Override
public boolean hasData() {
if (getItemName()!=null) return true;
if (getItemValue()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public W21_2.W21_2Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
W21_2.W21_2Builder o = (W21_2.W21_2Builder) 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_2 _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_2Builder {" +
"itemName=" + this.itemName + ", " +
"itemValue=" + this.itemValue +
'}';
}
}
}