com.rosetta.metatest.model.Observable13 Maven / Gradle / Ivy
package com.rosetta.metatest.model;
import com.rosetta.metatest.model.Asset13;
import com.rosetta.metatest.model.Observable13;
import com.rosetta.metatest.model.Observable13.Observable13Builder;
import com.rosetta.metatest.model.Observable13.Observable13BuilderImpl;
import com.rosetta.metatest.model.Observable13.Observable13Impl;
import com.rosetta.metatest.model.meta.Observable13Meta;
import com.rosetta.metatest.model.metafields.FieldWithMetaAsset13;
import com.rosetta.metatest.model.metafields.FieldWithMetaAsset13.FieldWithMetaAsset13Builder;
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.Key;
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="Observable13", builder=Observable13.Observable13BuilderImpl.class, version="test")
public interface Observable13 extends RosettaModelObject {
Observable13Meta metaData = new Observable13Meta();
/*********************** Getter Methods ***********************/
FieldWithMetaAsset13 getAsset13();
/*********************** Build Methods ***********************/
Observable13 build();
Observable13.Observable13Builder toBuilder();
static Observable13.Observable13Builder builder() {
return new Observable13.Observable13BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends Observable13> metaData() {
return metaData;
}
@Override
default Class extends Observable13> getType() {
return Observable13.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processRosetta(path.newSubPath("Asset13"), processor, FieldWithMetaAsset13.class, getAsset13());
}
/*********************** Builder Interface ***********************/
interface Observable13Builder extends Observable13, RosettaModelObjectBuilder {
FieldWithMetaAsset13.FieldWithMetaAsset13Builder getOrCreateAsset13();
FieldWithMetaAsset13.FieldWithMetaAsset13Builder getAsset13();
Observable13.Observable13Builder setAsset13(FieldWithMetaAsset13 Asset130);
Observable13.Observable13Builder setAsset13Value(Asset13 Asset131);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processRosetta(path.newSubPath("Asset13"), processor, FieldWithMetaAsset13.FieldWithMetaAsset13Builder.class, getAsset13());
}
Observable13.Observable13Builder prune();
}
/*********************** Immutable Implementation of Observable13 ***********************/
class Observable13Impl implements Observable13 {
private final FieldWithMetaAsset13 asset13;
protected Observable13Impl(Observable13.Observable13Builder builder) {
this.asset13 = ofNullable(builder.getAsset13()).map(f->f.build()).orElse(null);
}
@Override
@RosettaAttribute("Asset13")
public FieldWithMetaAsset13 getAsset13() {
return asset13;
}
@Override
public Observable13 build() {
return this;
}
@Override
public Observable13.Observable13Builder toBuilder() {
Observable13.Observable13Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(Observable13.Observable13Builder builder) {
ofNullable(getAsset13()).ifPresent(builder::setAsset13);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
Observable13 _that = getType().cast(o);
if (!Objects.equals(asset13, _that.getAsset13())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (asset13 != null ? asset13.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "Observable13 {" +
"Asset13=" + this.asset13 +
'}';
}
}
/*********************** Builder Implementation of Observable13 ***********************/
class Observable13BuilderImpl implements Observable13.Observable13Builder {
protected FieldWithMetaAsset13.FieldWithMetaAsset13Builder asset13;
public Observable13BuilderImpl() {
}
@Override
@RosettaAttribute("Asset13")
public FieldWithMetaAsset13.FieldWithMetaAsset13Builder getAsset13() {
return asset13;
}
@Override
public FieldWithMetaAsset13.FieldWithMetaAsset13Builder getOrCreateAsset13() {
FieldWithMetaAsset13.FieldWithMetaAsset13Builder result;
if (asset13!=null) {
result = asset13;
}
else {
result = asset13 = FieldWithMetaAsset13.builder();
result.getOrCreateMeta().toBuilder().addKey(Key.builder().setScope("DOCUMENT"));
}
return result;
}
@Override
@RosettaAttribute("Asset13")
public Observable13.Observable13Builder setAsset13(FieldWithMetaAsset13 asset13) {
this.asset13 = asset13==null?null:asset13.toBuilder();
return this;
}
@Override
public Observable13.Observable13Builder setAsset13Value(Asset13 asset13) {
this.getOrCreateAsset13().setValue(asset13);
return this;
}
@Override
public Observable13 build() {
return new Observable13.Observable13Impl(this);
}
@Override
public Observable13.Observable13Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public Observable13.Observable13Builder prune() {
if (asset13!=null && !asset13.prune().hasData()) asset13 = null;
return this;
}
@Override
public boolean hasData() {
if (getAsset13()!=null && getAsset13().hasData()) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public Observable13.Observable13Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
Observable13.Observable13Builder o = (Observable13.Observable13Builder) other;
merger.mergeRosetta(getAsset13(), o.getAsset13(), this::setAsset13);
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;
Observable13 _that = getType().cast(o);
if (!Objects.equals(asset13, _that.getAsset13())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (asset13 != null ? asset13.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "Observable13Builder {" +
"Asset13=" + this.asset13 +
'}';
}
}
}