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