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.V24b 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.V24b;
import com.rosetta.testconditional.model.V24b.V24bBuilder;
import com.rosetta.testconditional.model.V24b.V24bBuilderImpl;
import com.rosetta.testconditional.model.V24b.V24bImpl;
import com.rosetta.testconditional.model.W24b;
import com.rosetta.testconditional.model.meta.V24bMeta;
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="V24b", builder=V24b.V24bBuilderImpl.class, version="test")
public interface V24b extends RosettaModelObject {
V24bMeta metaData = new V24bMeta();
/*********************** Getter Methods ***********************/
String getWField1();
List extends W24b> getWField2();
String getWField3();
/*********************** Build Methods ***********************/
V24b build();
V24b.V24bBuilder toBuilder();
static V24b.V24bBuilder builder() {
return new V24b.V24bBuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends V24b> metaData() {
return metaData;
}
@Override
default Class extends V24b> getType() {
return V24b.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processor.processBasic(path.newSubPath("wField1"), String.class, getWField1(), this);
processRosetta(path.newSubPath("wField2"), processor, W24b.class, getWField2());
processor.processBasic(path.newSubPath("wField3"), String.class, getWField3(), this);
}
/*********************** Builder Interface ***********************/
interface V24bBuilder extends V24b, RosettaModelObjectBuilder {
W24b.W24bBuilder getOrCreateWField2(int _index);
List extends W24b.W24bBuilder> getWField2();
V24b.V24bBuilder setWField1(String wField1);
V24b.V24bBuilder addWField2(W24b wField20);
V24b.V24bBuilder addWField2(W24b wField21, int _idx);
V24b.V24bBuilder addWField2(List extends W24b> wField22);
V24b.V24bBuilder setWField2(List extends W24b> wField23);
V24b.V24bBuilder setWField3(String wField3);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processor.processBasic(path.newSubPath("wField1"), String.class, getWField1(), this);
processRosetta(path.newSubPath("wField2"), processor, W24b.W24bBuilder.class, getWField2());
processor.processBasic(path.newSubPath("wField3"), String.class, getWField3(), this);
}
V24b.V24bBuilder prune();
}
/*********************** Immutable Implementation of V24b ***********************/
class V24bImpl implements V24b {
private final String wField1;
private final List extends W24b> wField2;
private final String wField3;
protected V24bImpl(V24b.V24bBuilder builder) {
this.wField1 = builder.getWField1();
this.wField2 = ofNullable(builder.getWField2()).filter(_l->!_l.isEmpty()).map(list -> list.stream().filter(Objects::nonNull).map(f->f.build()).filter(Objects::nonNull).collect(ImmutableList.toImmutableList())).orElse(null);
this.wField3 = builder.getWField3();
}
@Override
@RosettaAttribute("wField1")
public String getWField1() {
return wField1;
}
@Override
@RosettaAttribute("wField2")
public List extends W24b> getWField2() {
return wField2;
}
@Override
@RosettaAttribute("wField3")
public String getWField3() {
return wField3;
}
@Override
public V24b build() {
return this;
}
@Override
public V24b.V24bBuilder toBuilder() {
V24b.V24bBuilder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(V24b.V24bBuilder builder) {
ofNullable(getWField1()).ifPresent(builder::setWField1);
ofNullable(getWField2()).ifPresent(builder::setWField2);
ofNullable(getWField3()).ifPresent(builder::setWField3);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
V24b _that = getType().cast(o);
if (!Objects.equals(wField1, _that.getWField1())) return false;
if (!ListEquals.listEquals(wField2, _that.getWField2())) return false;
if (!Objects.equals(wField3, _that.getWField3())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (wField1 != null ? wField1.hashCode() : 0);
_result = 31 * _result + (wField2 != null ? wField2.hashCode() : 0);
_result = 31 * _result + (wField3 != null ? wField3.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "V24b {" +
"wField1=" + this.wField1 + ", " +
"wField2=" + this.wField2 + ", " +
"wField3=" + this.wField3 +
'}';
}
}
/*********************** Builder Implementation of V24b ***********************/
class V24bBuilderImpl implements V24b.V24bBuilder {
protected String wField1;
protected List wField2 = new ArrayList<>();
protected String wField3;
public V24bBuilderImpl() {
}
@Override
@RosettaAttribute("wField1")
public String getWField1() {
return wField1;
}
@Override
@RosettaAttribute("wField2")
public List extends W24b.W24bBuilder> getWField2() {
return wField2;
}
public W24b.W24bBuilder getOrCreateWField2(int _index) {
if (wField2==null) {
this.wField2 = new ArrayList<>();
}
W24b.W24bBuilder result;
return getIndex(wField2, _index, () -> {
W24b.W24bBuilder newWField2 = W24b.builder();
return newWField2;
});
}
@Override
@RosettaAttribute("wField3")
public String getWField3() {
return wField3;
}
@Override
@RosettaAttribute("wField1")
public V24b.V24bBuilder setWField1(String wField1) {
this.wField1 = wField1==null?null:wField1;
return this;
}
@Override
public V24b.V24bBuilder addWField2(W24b wField2) {
if (wField2!=null) this.wField2.add(wField2.toBuilder());
return this;
}
@Override
public V24b.V24bBuilder addWField2(W24b wField2, int _idx) {
getIndex(this.wField2, _idx, () -> wField2.toBuilder());
return this;
}
@Override
public V24b.V24bBuilder addWField2(List extends W24b> wField2s) {
if (wField2s != null) {
for (W24b toAdd : wField2s) {
this.wField2.add(toAdd.toBuilder());
}
}
return this;
}
@Override
@RosettaAttribute("wField2")
public V24b.V24bBuilder setWField2(List extends W24b> wField2s) {
if (wField2s == null) {
this.wField2 = new ArrayList<>();
}
else {
this.wField2 = wField2s.stream()
.map(_a->_a.toBuilder())
.collect(Collectors.toCollection(()->new ArrayList<>()));
}
return this;
}
@Override
@RosettaAttribute("wField3")
public V24b.V24bBuilder setWField3(String wField3) {
this.wField3 = wField3==null?null:wField3;
return this;
}
@Override
public V24b build() {
return new V24b.V24bImpl(this);
}
@Override
public V24b.V24bBuilder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public V24b.V24bBuilder prune() {
wField2 = wField2.stream().filter(b->b!=null).map(b->b.prune()).filter(b->b.hasData()).collect(Collectors.toList());
return this;
}
@Override
public boolean hasData() {
if (getWField1()!=null) return true;
if (getWField2()!=null && getWField2().stream().filter(Objects::nonNull).anyMatch(a->a.hasData())) return true;
if (getWField3()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public V24b.V24bBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
V24b.V24bBuilder o = (V24b.V24bBuilder) other;
merger.mergeRosetta(getWField2(), o.getWField2(), this::getOrCreateWField2);
merger.mergeBasic(getWField1(), o.getWField1(), this::setWField1);
merger.mergeBasic(getWField3(), o.getWField3(), this::setWField3);
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;
V24b _that = getType().cast(o);
if (!Objects.equals(wField1, _that.getWField1())) return false;
if (!ListEquals.listEquals(wField2, _that.getWField2())) return false;
if (!Objects.equals(wField3, _that.getWField3())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (wField1 != null ? wField1.hashCode() : 0);
_result = 31 * _result + (wField2 != null ? wField2.hashCode() : 0);
_result = 31 * _result + (wField3 != null ? wField3.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "V24bBuilder {" +
"wField1=" + this.wField1 + ", " +
"wField2=" + this.wField2 + ", " +
"wField3=" + this.wField3 +
'}';
}
}
}