All Downloads are FREE. Search and download functionalities are using the official Maven repository.
Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
com.rosetta.testconditional.model.V17_1 Maven / Gradle / Ivy
package com.rosetta.testconditional.model;
import com.google.common.collect.ImmutableList;
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.V17_1;
import com.rosetta.testconditional.model.V17_1.V17_1Builder;
import com.rosetta.testconditional.model.V17_1.V17_1BuilderImpl;
import com.rosetta.testconditional.model.V17_1.V17_1Impl;
import com.rosetta.testconditional.model.W17_1;
import com.rosetta.testconditional.model.meta.V17_1Meta;
import com.rosetta.util.ListEquals;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="V17_1", builder=V17_1.V17_1BuilderImpl.class, version="test")
public interface V17_1 extends RosettaModelObject {
V17_1Meta metaData = new V17_1Meta();
/*********************** Getter Methods ***********************/
List extends W17_1> getWField();
String getXField();
/*********************** Build Methods ***********************/
V17_1 build();
V17_1.V17_1Builder toBuilder();
static V17_1.V17_1Builder builder() {
return new V17_1.V17_1BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends V17_1> metaData() {
return metaData;
}
@Override
default Class extends V17_1> getType() {
return V17_1.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processRosetta(path.newSubPath("wField"), processor, W17_1.class, getWField());
processor.processBasic(path.newSubPath("xField"), String.class, getXField(), this);
}
/*********************** Builder Interface ***********************/
interface V17_1Builder extends V17_1, RosettaModelObjectBuilder {
W17_1.W17_1Builder getOrCreateWField(int _index);
List extends W17_1.W17_1Builder> getWField();
V17_1.V17_1Builder addWField(W17_1 wField0);
V17_1.V17_1Builder addWField(W17_1 wField1, int _idx);
V17_1.V17_1Builder addWField(List extends W17_1> wField2);
V17_1.V17_1Builder setWField(List extends W17_1> wField3);
V17_1.V17_1Builder setXField(String xField);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processRosetta(path.newSubPath("wField"), processor, W17_1.W17_1Builder.class, getWField());
processor.processBasic(path.newSubPath("xField"), String.class, getXField(), this);
}
V17_1.V17_1Builder prune();
}
/*********************** Immutable Implementation of V17_1 ***********************/
class V17_1Impl implements V17_1 {
private final List extends W17_1> wField;
private final String xField;
protected V17_1Impl(V17_1.V17_1Builder builder) {
this.wField = ofNullable(builder.getWField()).filter(_l->!_l.isEmpty()).map(list -> list.stream().filter(Objects::nonNull).map(f->f.build()).filter(Objects::nonNull).collect(ImmutableList.toImmutableList())).orElse(null);
this.xField = builder.getXField();
}
@Override
@RosettaAttribute("wField")
public List extends W17_1> getWField() {
return wField;
}
@Override
@RosettaAttribute("xField")
public String getXField() {
return xField;
}
@Override
public V17_1 build() {
return this;
}
@Override
public V17_1.V17_1Builder toBuilder() {
V17_1.V17_1Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(V17_1.V17_1Builder builder) {
ofNullable(getWField()).ifPresent(builder::setWField);
ofNullable(getXField()).ifPresent(builder::setXField);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
V17_1 _that = getType().cast(o);
if (!ListEquals.listEquals(wField, _that.getWField())) return false;
if (!Objects.equals(xField, _that.getXField())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (wField != null ? wField.hashCode() : 0);
_result = 31 * _result + (xField != null ? xField.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "V17_1 {" +
"wField=" + this.wField + ", " +
"xField=" + this.xField +
'}';
}
}
/*********************** Builder Implementation of V17_1 ***********************/
class V17_1BuilderImpl implements V17_1.V17_1Builder {
protected List wField = new ArrayList<>();
protected String xField;
public V17_1BuilderImpl() {
}
@Override
@RosettaAttribute("wField")
public List extends W17_1.W17_1Builder> getWField() {
return wField;
}
public W17_1.W17_1Builder getOrCreateWField(int _index) {
if (wField==null) {
this.wField = new ArrayList<>();
}
W17_1.W17_1Builder result;
return getIndex(wField, _index, () -> {
W17_1.W17_1Builder newWField = W17_1.builder();
return newWField;
});
}
@Override
@RosettaAttribute("xField")
public String getXField() {
return xField;
}
@Override
public V17_1.V17_1Builder addWField(W17_1 wField) {
if (wField!=null) this.wField.add(wField.toBuilder());
return this;
}
@Override
public V17_1.V17_1Builder addWField(W17_1 wField, int _idx) {
getIndex(this.wField, _idx, () -> wField.toBuilder());
return this;
}
@Override
public V17_1.V17_1Builder addWField(List extends W17_1> wFields) {
if (wFields != null) {
for (W17_1 toAdd : wFields) {
this.wField.add(toAdd.toBuilder());
}
}
return this;
}
@Override
@RosettaAttribute("wField")
public V17_1.V17_1Builder setWField(List extends W17_1> wFields) {
if (wFields == null) {
this.wField = new ArrayList<>();
}
else {
this.wField = wFields.stream()
.map(_a->_a.toBuilder())
.collect(Collectors.toCollection(()->new ArrayList<>()));
}
return this;
}
@Override
@RosettaAttribute("xField")
public V17_1.V17_1Builder setXField(String xField) {
this.xField = xField==null?null:xField;
return this;
}
@Override
public V17_1 build() {
return new V17_1.V17_1Impl(this);
}
@Override
public V17_1.V17_1Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public V17_1.V17_1Builder prune() {
wField = wField.stream().filter(b->b!=null).map(b->b.prune()).filter(b->b.hasData()).collect(Collectors.toList());
return this;
}
@Override
public boolean hasData() {
if (getWField()!=null && getWField().stream().filter(Objects::nonNull).anyMatch(a->a.hasData())) return true;
if (getXField()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public V17_1.V17_1Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
V17_1.V17_1Builder o = (V17_1.V17_1Builder) other;
merger.mergeRosetta(getWField(), o.getWField(), this::getOrCreateWField);
merger.mergeBasic(getXField(), o.getXField(), this::setXField);
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;
V17_1 _that = getType().cast(o);
if (!ListEquals.listEquals(wField, _that.getWField())) return false;
if (!Objects.equals(xField, _that.getXField())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (wField != null ? wField.hashCode() : 0);
_result = 31 * _result + (xField != null ? xField.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "V17_1Builder {" +
"wField=" + this.wField + ", " +
"xField=" + this.xField +
'}';
}
}
}