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.V24 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.V24;
import com.rosetta.testconditional.model.V24.V24Builder;
import com.rosetta.testconditional.model.V24.V24BuilderImpl;
import com.rosetta.testconditional.model.V24.V24Impl;
import com.rosetta.testconditional.model.W24;
import com.rosetta.testconditional.model.meta.V24Meta;
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="V24", builder=V24.V24BuilderImpl.class, version="test")
public interface V24 extends RosettaModelObject {
V24Meta metaData = new V24Meta();
/*********************** Getter Methods ***********************/
String getWField1();
List extends W24> getWField2();
String getWField3();
/*********************** Build Methods ***********************/
V24 build();
V24.V24Builder toBuilder();
static V24.V24Builder builder() {
return new V24.V24BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends V24> metaData() {
return metaData;
}
@Override
default Class extends V24> getType() {
return V24.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processor.processBasic(path.newSubPath("wField1"), String.class, getWField1(), this);
processRosetta(path.newSubPath("wField2"), processor, W24.class, getWField2());
processor.processBasic(path.newSubPath("wField3"), String.class, getWField3(), this);
}
/*********************** Builder Interface ***********************/
interface V24Builder extends V24, RosettaModelObjectBuilder {
W24.W24Builder getOrCreateWField2(int _index);
List extends W24.W24Builder> getWField2();
V24.V24Builder setWField1(String wField1);
V24.V24Builder addWField2(W24 wField20);
V24.V24Builder addWField2(W24 wField21, int _idx);
V24.V24Builder addWField2(List extends W24> wField22);
V24.V24Builder setWField2(List extends W24> wField23);
V24.V24Builder 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, W24.W24Builder.class, getWField2());
processor.processBasic(path.newSubPath("wField3"), String.class, getWField3(), this);
}
V24.V24Builder prune();
}
/*********************** Immutable Implementation of V24 ***********************/
class V24Impl implements V24 {
private final String wField1;
private final List extends W24> wField2;
private final String wField3;
protected V24Impl(V24.V24Builder 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 W24> getWField2() {
return wField2;
}
@Override
@RosettaAttribute("wField3")
public String getWField3() {
return wField3;
}
@Override
public V24 build() {
return this;
}
@Override
public V24.V24Builder toBuilder() {
V24.V24Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(V24.V24Builder 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;
V24 _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 "V24 {" +
"wField1=" + this.wField1 + ", " +
"wField2=" + this.wField2 + ", " +
"wField3=" + this.wField3 +
'}';
}
}
/*********************** Builder Implementation of V24 ***********************/
class V24BuilderImpl implements V24.V24Builder {
protected String wField1;
protected List wField2 = new ArrayList<>();
protected String wField3;
public V24BuilderImpl() {
}
@Override
@RosettaAttribute("wField1")
public String getWField1() {
return wField1;
}
@Override
@RosettaAttribute("wField2")
public List extends W24.W24Builder> getWField2() {
return wField2;
}
public W24.W24Builder getOrCreateWField2(int _index) {
if (wField2==null) {
this.wField2 = new ArrayList<>();
}
W24.W24Builder result;
return getIndex(wField2, _index, () -> {
W24.W24Builder newWField2 = W24.builder();
return newWField2;
});
}
@Override
@RosettaAttribute("wField3")
public String getWField3() {
return wField3;
}
@Override
@RosettaAttribute("wField1")
public V24.V24Builder setWField1(String wField1) {
this.wField1 = wField1==null?null:wField1;
return this;
}
@Override
public V24.V24Builder addWField2(W24 wField2) {
if (wField2!=null) this.wField2.add(wField2.toBuilder());
return this;
}
@Override
public V24.V24Builder addWField2(W24 wField2, int _idx) {
getIndex(this.wField2, _idx, () -> wField2.toBuilder());
return this;
}
@Override
public V24.V24Builder addWField2(List extends W24> wField2s) {
if (wField2s != null) {
for (W24 toAdd : wField2s) {
this.wField2.add(toAdd.toBuilder());
}
}
return this;
}
@Override
@RosettaAttribute("wField2")
public V24.V24Builder setWField2(List extends W24> 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 V24.V24Builder setWField3(String wField3) {
this.wField3 = wField3==null?null:wField3;
return this;
}
@Override
public V24 build() {
return new V24.V24Impl(this);
}
@Override
public V24.V24Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public V24.V24Builder 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 V24.V24Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
V24.V24Builder o = (V24.V24Builder) 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;
V24 _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 "V24Builder {" +
"wField1=" + this.wField1 + ", " +
"wField2=" + this.wField2 + ", " +
"wField3=" + this.wField3 +
'}';
}
}
}