com.rosetta.metatest.model.ResolvableObservable13_2 Maven / Gradle / Ivy
package com.rosetta.metatest.model;
import com.rosetta.metatest.model.Observable13_2;
import com.rosetta.metatest.model.ResolvableObservable13_2;
import com.rosetta.metatest.model.ResolvableObservable13_2.ResolvableObservable13_2Builder;
import com.rosetta.metatest.model.ResolvableObservable13_2.ResolvableObservable13_2BuilderImpl;
import com.rosetta.metatest.model.ResolvableObservable13_2.ResolvableObservable13_2Impl;
import com.rosetta.metatest.model.meta.ResolvableObservable13_2Meta;
import com.rosetta.metatest.model.metafields.ReferenceWithMetaObservable13_2;
import com.rosetta.metatest.model.metafields.ReferenceWithMetaObservable13_2.ReferenceWithMetaObservable13_2Builder;
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 java.util.Objects;
import static java.util.Optional.ofNullable;
/**
* @version test
*/
@RosettaDataType(value="ResolvableObservable13_2", builder=ResolvableObservable13_2.ResolvableObservable13_2BuilderImpl.class, version="test")
public interface ResolvableObservable13_2 extends RosettaModelObject {
ResolvableObservable13_2Meta metaData = new ResolvableObservable13_2Meta();
/*********************** Getter Methods ***********************/
ReferenceWithMetaObservable13_2 getResolvedObservable();
/*********************** Build Methods ***********************/
ResolvableObservable13_2 build();
ResolvableObservable13_2.ResolvableObservable13_2Builder toBuilder();
static ResolvableObservable13_2.ResolvableObservable13_2Builder builder() {
return new ResolvableObservable13_2.ResolvableObservable13_2BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends ResolvableObservable13_2> metaData() {
return metaData;
}
@Override
default Class extends ResolvableObservable13_2> getType() {
return ResolvableObservable13_2.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processRosetta(path.newSubPath("resolvedObservable"), processor, ReferenceWithMetaObservable13_2.class, getResolvedObservable());
}
/*********************** Builder Interface ***********************/
interface ResolvableObservable13_2Builder extends ResolvableObservable13_2, RosettaModelObjectBuilder {
ReferenceWithMetaObservable13_2.ReferenceWithMetaObservable13_2Builder getOrCreateResolvedObservable();
ReferenceWithMetaObservable13_2.ReferenceWithMetaObservable13_2Builder getResolvedObservable();
ResolvableObservable13_2.ResolvableObservable13_2Builder setResolvedObservable(ReferenceWithMetaObservable13_2 resolvedObservable0);
ResolvableObservable13_2.ResolvableObservable13_2Builder setResolvedObservableValue(Observable13_2 resolvedObservable1);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processRosetta(path.newSubPath("resolvedObservable"), processor, ReferenceWithMetaObservable13_2.ReferenceWithMetaObservable13_2Builder.class, getResolvedObservable());
}
ResolvableObservable13_2.ResolvableObservable13_2Builder prune();
}
/*********************** Immutable Implementation of ResolvableObservable13_2 ***********************/
class ResolvableObservable13_2Impl implements ResolvableObservable13_2 {
private final ReferenceWithMetaObservable13_2 resolvedObservable;
protected ResolvableObservable13_2Impl(ResolvableObservable13_2.ResolvableObservable13_2Builder builder) {
this.resolvedObservable = ofNullable(builder.getResolvedObservable()).map(f->f.build()).orElse(null);
}
@Override
@RosettaAttribute("resolvedObservable")
public ReferenceWithMetaObservable13_2 getResolvedObservable() {
return resolvedObservable;
}
@Override
public ResolvableObservable13_2 build() {
return this;
}
@Override
public ResolvableObservable13_2.ResolvableObservable13_2Builder toBuilder() {
ResolvableObservable13_2.ResolvableObservable13_2Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(ResolvableObservable13_2.ResolvableObservable13_2Builder builder) {
ofNullable(getResolvedObservable()).ifPresent(builder::setResolvedObservable);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
ResolvableObservable13_2 _that = getType().cast(o);
if (!Objects.equals(resolvedObservable, _that.getResolvedObservable())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (resolvedObservable != null ? resolvedObservable.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "ResolvableObservable13_2 {" +
"resolvedObservable=" + this.resolvedObservable +
'}';
}
}
/*********************** Builder Implementation of ResolvableObservable13_2 ***********************/
class ResolvableObservable13_2BuilderImpl implements ResolvableObservable13_2.ResolvableObservable13_2Builder {
protected ReferenceWithMetaObservable13_2.ReferenceWithMetaObservable13_2Builder resolvedObservable;
public ResolvableObservable13_2BuilderImpl() {
}
@Override
@RosettaAttribute("resolvedObservable")
public ReferenceWithMetaObservable13_2.ReferenceWithMetaObservable13_2Builder getResolvedObservable() {
return resolvedObservable;
}
@Override
public ReferenceWithMetaObservable13_2.ReferenceWithMetaObservable13_2Builder getOrCreateResolvedObservable() {
ReferenceWithMetaObservable13_2.ReferenceWithMetaObservable13_2Builder result;
if (resolvedObservable!=null) {
result = resolvedObservable;
}
else {
result = resolvedObservable = ReferenceWithMetaObservable13_2.builder();
}
return result;
}
@Override
@RosettaAttribute("resolvedObservable")
public ResolvableObservable13_2.ResolvableObservable13_2Builder setResolvedObservable(ReferenceWithMetaObservable13_2 resolvedObservable) {
this.resolvedObservable = resolvedObservable==null?null:resolvedObservable.toBuilder();
return this;
}
@Override
public ResolvableObservable13_2.ResolvableObservable13_2Builder setResolvedObservableValue(Observable13_2 resolvedObservable) {
this.getOrCreateResolvedObservable().setValue(resolvedObservable);
return this;
}
@Override
public ResolvableObservable13_2 build() {
return new ResolvableObservable13_2.ResolvableObservable13_2Impl(this);
}
@Override
public ResolvableObservable13_2.ResolvableObservable13_2Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public ResolvableObservable13_2.ResolvableObservable13_2Builder prune() {
if (resolvedObservable!=null && !resolvedObservable.prune().hasData()) resolvedObservable = null;
return this;
}
@Override
public boolean hasData() {
if (getResolvedObservable()!=null && getResolvedObservable().hasData()) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public ResolvableObservable13_2.ResolvableObservable13_2Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
ResolvableObservable13_2.ResolvableObservable13_2Builder o = (ResolvableObservable13_2.ResolvableObservable13_2Builder) other;
merger.mergeRosetta(getResolvedObservable(), o.getResolvedObservable(), this::setResolvedObservable);
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;
ResolvableObservable13_2 _that = getType().cast(o);
if (!Objects.equals(resolvedObservable, _that.getResolvedObservable())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (resolvedObservable != null ? resolvedObservable.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "ResolvableObservable13_2Builder {" +
"resolvedObservable=" + this.resolvedObservable +
'}';
}
}
}