com.rosetta.metatest.model.PriceQuantity13_2 Maven / Gradle / Ivy
package com.rosetta.metatest.model;
import com.rosetta.metatest.model.Observable13_2;
import com.rosetta.metatest.model.PriceQuantity13_2;
import com.rosetta.metatest.model.PriceQuantity13_2.PriceQuantity13_2Builder;
import com.rosetta.metatest.model.PriceQuantity13_2.PriceQuantity13_2BuilderImpl;
import com.rosetta.metatest.model.PriceQuantity13_2.PriceQuantity13_2Impl;
import com.rosetta.metatest.model.meta.PriceQuantity13_2Meta;
import com.rosetta.metatest.model.metafields.FieldWithMetaObservable13_2;
import com.rosetta.metatest.model.metafields.FieldWithMetaObservable13_2.FieldWithMetaObservable13_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.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="PriceQuantity13_2", builder=PriceQuantity13_2.PriceQuantity13_2BuilderImpl.class, version="test")
public interface PriceQuantity13_2 extends RosettaModelObject {
PriceQuantity13_2Meta metaData = new PriceQuantity13_2Meta();
/*********************** Getter Methods ***********************/
FieldWithMetaObservable13_2 getObservable();
/*********************** Build Methods ***********************/
PriceQuantity13_2 build();
PriceQuantity13_2.PriceQuantity13_2Builder toBuilder();
static PriceQuantity13_2.PriceQuantity13_2Builder builder() {
return new PriceQuantity13_2.PriceQuantity13_2BuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends PriceQuantity13_2> metaData() {
return metaData;
}
@Override
default Class extends PriceQuantity13_2> getType() {
return PriceQuantity13_2.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processRosetta(path.newSubPath("observable"), processor, FieldWithMetaObservable13_2.class, getObservable());
}
/*********************** Builder Interface ***********************/
interface PriceQuantity13_2Builder extends PriceQuantity13_2, RosettaModelObjectBuilder {
FieldWithMetaObservable13_2.FieldWithMetaObservable13_2Builder getOrCreateObservable();
@Override
FieldWithMetaObservable13_2.FieldWithMetaObservable13_2Builder getObservable();
PriceQuantity13_2.PriceQuantity13_2Builder setObservable(FieldWithMetaObservable13_2 observable);
PriceQuantity13_2.PriceQuantity13_2Builder setObservableValue(Observable13_2 observable);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processRosetta(path.newSubPath("observable"), processor, FieldWithMetaObservable13_2.FieldWithMetaObservable13_2Builder.class, getObservable());
}
PriceQuantity13_2.PriceQuantity13_2Builder prune();
}
/*********************** Immutable Implementation of PriceQuantity13_2 ***********************/
class PriceQuantity13_2Impl implements PriceQuantity13_2 {
private final FieldWithMetaObservable13_2 observable;
protected PriceQuantity13_2Impl(PriceQuantity13_2.PriceQuantity13_2Builder builder) {
this.observable = ofNullable(builder.getObservable()).map(f->f.build()).orElse(null);
}
@Override
@RosettaAttribute("observable")
public FieldWithMetaObservable13_2 getObservable() {
return observable;
}
@Override
public PriceQuantity13_2 build() {
return this;
}
@Override
public PriceQuantity13_2.PriceQuantity13_2Builder toBuilder() {
PriceQuantity13_2.PriceQuantity13_2Builder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(PriceQuantity13_2.PriceQuantity13_2Builder 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;
PriceQuantity13_2 _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 "PriceQuantity13_2 {" +
"observable=" + this.observable +
'}';
}
}
/*********************** Builder Implementation of PriceQuantity13_2 ***********************/
class PriceQuantity13_2BuilderImpl implements PriceQuantity13_2.PriceQuantity13_2Builder {
protected FieldWithMetaObservable13_2.FieldWithMetaObservable13_2Builder observable;
@Override
@RosettaAttribute("observable")
public FieldWithMetaObservable13_2.FieldWithMetaObservable13_2Builder getObservable() {
return observable;
}
@Override
public FieldWithMetaObservable13_2.FieldWithMetaObservable13_2Builder getOrCreateObservable() {
FieldWithMetaObservable13_2.FieldWithMetaObservable13_2Builder result;
if (observable!=null) {
result = observable;
}
else {
result = observable = FieldWithMetaObservable13_2.builder();
result.getOrCreateMeta().toBuilder().addKey(Key.builder().setScope("DOCUMENT"));
}
return result;
}
@Override
@RosettaAttribute("observable")
public PriceQuantity13_2.PriceQuantity13_2Builder setObservable(FieldWithMetaObservable13_2 _observable) {
this.observable = _observable == null ? null : _observable.toBuilder();
return this;
}
@Override
public PriceQuantity13_2.PriceQuantity13_2Builder setObservableValue(Observable13_2 _observable) {
this.getOrCreateObservable().setValue(_observable);
return this;
}
@Override
public PriceQuantity13_2 build() {
return new PriceQuantity13_2.PriceQuantity13_2Impl(this);
}
@Override
public PriceQuantity13_2.PriceQuantity13_2Builder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public PriceQuantity13_2.PriceQuantity13_2Builder 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 PriceQuantity13_2.PriceQuantity13_2Builder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
PriceQuantity13_2.PriceQuantity13_2Builder o = (PriceQuantity13_2.PriceQuantity13_2Builder) 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;
PriceQuantity13_2 _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 "PriceQuantity13_2Builder {" +
"observable=" + this.observable +
'}';
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy