com.rosetta.metatest.model.PriceQuantity12 Maven / Gradle / Ivy
package com.rosetta.metatest.model;
import com.rosetta.metatest.model.Observable12;
import com.rosetta.metatest.model.PriceQuantity12;
import com.rosetta.metatest.model.PriceQuantity12.PriceQuantity12Builder;
import com.rosetta.metatest.model.PriceQuantity12.PriceQuantity12BuilderImpl;
import com.rosetta.metatest.model.PriceQuantity12.PriceQuantity12Impl;
import com.rosetta.metatest.model.meta.PriceQuantity12Meta;
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="PriceQuantity12", builder=PriceQuantity12.PriceQuantity12BuilderImpl.class, version="test")
public interface PriceQuantity12 extends RosettaModelObject {
PriceQuantity12Meta metaData = new PriceQuantity12Meta();
/*********************** Getter Methods ***********************/
Observable12 getObservable();
/*********************** Build Methods ***********************/
PriceQuantity12 build();
PriceQuantity12.PriceQuantity12Builder toBuilder();
static PriceQuantity12.PriceQuantity12Builder builder() {
return new PriceQuantity12.PriceQuantity12BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends PriceQuantity12> metaData() {
return metaData;
}
@Override
default Class extends PriceQuantity12> getType() {
return PriceQuantity12.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processRosetta(path.newSubPath("observable"), processor, Observable12.class, getObservable());
}
/*********************** Builder Interface ***********************/
interface PriceQuantity12Builder extends PriceQuantity12, RosettaModelObjectBuilder {
Observable12.Observable12Builder getOrCreateObservable();
Observable12.Observable12Builder getObservable();
PriceQuantity12.PriceQuantity12Builder setObservable(Observable12 observable);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processRosetta(path.newSubPath("observable"), processor, Observable12.Observable12Builder.class, getObservable());
}
PriceQuantity12.PriceQuantity12Builder prune();
}
/*********************** Immutable Implementation of PriceQuantity12 ***********************/
class PriceQuantity12Impl implements PriceQuantity12 {
private final Observable12 observable;
protected PriceQuantity12Impl(PriceQuantity12.PriceQuantity12Builder builder) {
this.observable = ofNullable(builder.getObservable()).map(f->f.build()).orElse(null);
}
@Override
@RosettaAttribute("observable")
public Observable12 getObservable() {
return observable;
}
@Override
public PriceQuantity12 build() {
return this;
}
@Override
public PriceQuantity12.PriceQuantity12Builder toBuilder() {
PriceQuantity12.PriceQuantity12Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(PriceQuantity12.PriceQuantity12Builder builder) {
ofNullable(getObservable()).ifPresent(builder::setObservable);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
PriceQuantity12 _that = getType().cast(o);
if (!Objects.equals(observable, _that.getObservable())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (observable != null ? observable.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "PriceQuantity12 {" +
"observable=" + this.observable +
'}';
}
}
/*********************** Builder Implementation of PriceQuantity12 ***********************/
class PriceQuantity12BuilderImpl implements PriceQuantity12.PriceQuantity12Builder {
protected Observable12.Observable12Builder observable;
public PriceQuantity12BuilderImpl() {
}
@Override
@RosettaAttribute("observable")
public Observable12.Observable12Builder getObservable() {
return observable;
}
@Override
public Observable12.Observable12Builder getOrCreateObservable() {
Observable12.Observable12Builder result;
if (observable!=null) {
result = observable;
}
else {
result = observable = Observable12.builder();
}
return result;
}
@Override
@RosettaAttribute("observable")
public PriceQuantity12.PriceQuantity12Builder setObservable(Observable12 observable) {
this.observable = observable==null?null:observable.toBuilder();
return this;
}
@Override
public PriceQuantity12 build() {
return new PriceQuantity12.PriceQuantity12Impl(this);
}
@Override
public PriceQuantity12.PriceQuantity12Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public PriceQuantity12.PriceQuantity12Builder prune() {
if (observable!=null && !observable.prune().hasData()) observable = null;
return this;
}
@Override
public boolean hasData() {
if (getObservable()!=null && getObservable().hasData()) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public PriceQuantity12.PriceQuantity12Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
PriceQuantity12.PriceQuantity12Builder o = (PriceQuantity12.PriceQuantity12Builder) other;
merger.mergeRosetta(getObservable(), o.getObservable(), this::setObservable);
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;
PriceQuantity12 _that = getType().cast(o);
if (!Objects.equals(observable, _that.getObservable())) return false;
return true;
}
@Override
public int hashCode() {
int _result = 0;
_result = 31 * _result + (observable != null ? observable.hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "PriceQuantity12Builder {" +
"observable=" + this.observable +
'}';
}
}
}