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