cdm.observable.asset.InflationIndex Maven / Gradle / Ivy
package cdm.observable.asset;
import cdm.base.staticdata.asset.common.AssetClassEnum;
import cdm.base.staticdata.asset.common.AssetIdentifier;
import cdm.base.staticdata.asset.common.IndexBase;
import cdm.base.staticdata.asset.common.IndexBase.IndexBaseBuilder;
import cdm.base.staticdata.asset.common.IndexBase.IndexBaseBuilderImpl;
import cdm.base.staticdata.asset.common.IndexBase.IndexBaseImpl;
import cdm.base.staticdata.asset.common.Taxonomy;
import cdm.base.staticdata.asset.rates.InflationRateIndexEnum;
import cdm.base.staticdata.asset.rates.metafields.FieldWithMetaInflationRateIndexEnum;
import cdm.base.staticdata.asset.rates.metafields.FieldWithMetaInflationRateIndexEnum.FieldWithMetaInflationRateIndexEnumBuilder;
import cdm.base.staticdata.party.LegalEntity;
import cdm.observable.asset.InflationIndex;
import cdm.observable.asset.InflationIndex.InflationIndexBuilder;
import cdm.observable.asset.InflationIndex.InflationIndexBuilderImpl;
import cdm.observable.asset.InflationIndex.InflationIndexImpl;
import cdm.observable.asset.meta.InflationIndexMeta;
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.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import static java.util.Optional.ofNullable;
/**
* Specification of an index that measures inflation in a specific market, e.g. the US Consumer Price Index.
* @version 6.0.0-dev.63
*/
@RosettaDataType(value="InflationIndex", builder=InflationIndex.InflationIndexBuilderImpl.class, version="6.0.0-dev.63")
public interface InflationIndex extends IndexBase {
InflationIndexMeta metaData = new InflationIndexMeta();
/*********************** Getter Methods ***********************/
/**
* The reference index that is used to specify the inflation interest rate.
*/
FieldWithMetaInflationRateIndexEnum getInflationRateIndex();
/*********************** Build Methods ***********************/
InflationIndex build();
InflationIndex.InflationIndexBuilder toBuilder();
static InflationIndex.InflationIndexBuilder builder() {
return new InflationIndex.InflationIndexBuilderImpl();
}
/*********************** Utility Methods ***********************/
@Override
default RosettaMetaData extends InflationIndex> metaData() {
return metaData;
}
@Override
default Class extends InflationIndex> getType() {
return InflationIndex.class;
}
@Override
default void process(RosettaPath path, Processor processor) {
processRosetta(path.newSubPath("identifier"), processor, AssetIdentifier.class, getIdentifier());
processRosetta(path.newSubPath("taxonomy"), processor, Taxonomy.class, getTaxonomy());
processor.processBasic(path.newSubPath("isExchangeListed"), Boolean.class, getIsExchangeListed(), this);
processRosetta(path.newSubPath("exchange"), processor, LegalEntity.class, getExchange());
processRosetta(path.newSubPath("relatedExchange"), processor, LegalEntity.class, getRelatedExchange());
processor.processBasic(path.newSubPath("name"), String.class, getName(), this);
processRosetta(path.newSubPath("provider"), processor, LegalEntity.class, getProvider());
processor.processBasic(path.newSubPath("assetClass"), AssetClassEnum.class, getAssetClass(), this);
processRosetta(path.newSubPath("inflationRateIndex"), processor, FieldWithMetaInflationRateIndexEnum.class, getInflationRateIndex());
}
/*********************** Builder Interface ***********************/
interface InflationIndexBuilder extends InflationIndex, IndexBase.IndexBaseBuilder, RosettaModelObjectBuilder {
FieldWithMetaInflationRateIndexEnum.FieldWithMetaInflationRateIndexEnumBuilder getOrCreateInflationRateIndex();
FieldWithMetaInflationRateIndexEnum.FieldWithMetaInflationRateIndexEnumBuilder getInflationRateIndex();
InflationIndex.InflationIndexBuilder addIdentifier(AssetIdentifier identifier0);
InflationIndex.InflationIndexBuilder addIdentifier(AssetIdentifier identifier1, int _idx);
InflationIndex.InflationIndexBuilder addIdentifier(List extends AssetIdentifier> identifier2);
InflationIndex.InflationIndexBuilder setIdentifier(List extends AssetIdentifier> identifier3);
InflationIndex.InflationIndexBuilder addTaxonomy(Taxonomy taxonomy0);
InflationIndex.InflationIndexBuilder addTaxonomy(Taxonomy taxonomy1, int _idx);
InflationIndex.InflationIndexBuilder addTaxonomy(List extends Taxonomy> taxonomy2);
InflationIndex.InflationIndexBuilder setTaxonomy(List extends Taxonomy> taxonomy3);
InflationIndex.InflationIndexBuilder setIsExchangeListed(Boolean isExchangeListed);
InflationIndex.InflationIndexBuilder setExchange(LegalEntity exchange);
InflationIndex.InflationIndexBuilder addRelatedExchange(LegalEntity relatedExchange0);
InflationIndex.InflationIndexBuilder addRelatedExchange(LegalEntity relatedExchange1, int _idx);
InflationIndex.InflationIndexBuilder addRelatedExchange(List extends LegalEntity> relatedExchange2);
InflationIndex.InflationIndexBuilder setRelatedExchange(List extends LegalEntity> relatedExchange3);
InflationIndex.InflationIndexBuilder setName(String name);
InflationIndex.InflationIndexBuilder setProvider(LegalEntity provider);
InflationIndex.InflationIndexBuilder setAssetClass(AssetClassEnum assetClass);
InflationIndex.InflationIndexBuilder setInflationRateIndex(FieldWithMetaInflationRateIndexEnum inflationRateIndex0);
InflationIndex.InflationIndexBuilder setInflationRateIndexValue(InflationRateIndexEnum inflationRateIndex1);
@Override
default void process(RosettaPath path, BuilderProcessor processor) {
processRosetta(path.newSubPath("identifier"), processor, AssetIdentifier.AssetIdentifierBuilder.class, getIdentifier());
processRosetta(path.newSubPath("taxonomy"), processor, Taxonomy.TaxonomyBuilder.class, getTaxonomy());
processor.processBasic(path.newSubPath("isExchangeListed"), Boolean.class, getIsExchangeListed(), this);
processRosetta(path.newSubPath("exchange"), processor, LegalEntity.LegalEntityBuilder.class, getExchange());
processRosetta(path.newSubPath("relatedExchange"), processor, LegalEntity.LegalEntityBuilder.class, getRelatedExchange());
processor.processBasic(path.newSubPath("name"), String.class, getName(), this);
processRosetta(path.newSubPath("provider"), processor, LegalEntity.LegalEntityBuilder.class, getProvider());
processor.processBasic(path.newSubPath("assetClass"), AssetClassEnum.class, getAssetClass(), this);
processRosetta(path.newSubPath("inflationRateIndex"), processor, FieldWithMetaInflationRateIndexEnum.FieldWithMetaInflationRateIndexEnumBuilder.class, getInflationRateIndex());
}
InflationIndex.InflationIndexBuilder prune();
}
/*********************** Immutable Implementation of InflationIndex ***********************/
class InflationIndexImpl extends IndexBase.IndexBaseImpl implements InflationIndex {
private final FieldWithMetaInflationRateIndexEnum inflationRateIndex;
protected InflationIndexImpl(InflationIndex.InflationIndexBuilder builder) {
super(builder);
this.inflationRateIndex = ofNullable(builder.getInflationRateIndex()).map(f->f.build()).orElse(null);
}
@Override
@RosettaAttribute("inflationRateIndex")
public FieldWithMetaInflationRateIndexEnum getInflationRateIndex() {
return inflationRateIndex;
}
@Override
public InflationIndex build() {
return this;
}
@Override
public InflationIndex.InflationIndexBuilder toBuilder() {
InflationIndex.InflationIndexBuilder builder = builder();
setBuilderFields(builder);
return builder;
}
protected void setBuilderFields(InflationIndex.InflationIndexBuilder builder) {
super.setBuilderFields(builder);
ofNullable(getInflationRateIndex()).ifPresent(builder::setInflationRateIndex);
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || !(o instanceof RosettaModelObject) || !getType().equals(((RosettaModelObject)o).getType())) return false;
if (!super.equals(o)) return false;
InflationIndex _that = getType().cast(o);
if (!Objects.equals(inflationRateIndex, _that.getInflationRateIndex())) return false;
return true;
}
@Override
public int hashCode() {
int _result = super.hashCode();
_result = 31 * _result + (inflationRateIndex != null ? inflationRateIndex.getClass().getName().hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "InflationIndex {" +
"inflationRateIndex=" + this.inflationRateIndex +
'}' + " " + super.toString();
}
}
/*********************** Builder Implementation of InflationIndex ***********************/
class InflationIndexBuilderImpl extends IndexBase.IndexBaseBuilderImpl implements InflationIndex.InflationIndexBuilder {
protected FieldWithMetaInflationRateIndexEnum.FieldWithMetaInflationRateIndexEnumBuilder inflationRateIndex;
public InflationIndexBuilderImpl() {
}
@Override
@RosettaAttribute("inflationRateIndex")
public FieldWithMetaInflationRateIndexEnum.FieldWithMetaInflationRateIndexEnumBuilder getInflationRateIndex() {
return inflationRateIndex;
}
@Override
public FieldWithMetaInflationRateIndexEnum.FieldWithMetaInflationRateIndexEnumBuilder getOrCreateInflationRateIndex() {
FieldWithMetaInflationRateIndexEnum.FieldWithMetaInflationRateIndexEnumBuilder result;
if (inflationRateIndex!=null) {
result = inflationRateIndex;
}
else {
result = inflationRateIndex = FieldWithMetaInflationRateIndexEnum.builder();
}
return result;
}
@Override
public InflationIndex.InflationIndexBuilder addIdentifier(AssetIdentifier identifier) {
if (identifier!=null) this.identifier.add(identifier.toBuilder());
return this;
}
@Override
public InflationIndex.InflationIndexBuilder addIdentifier(AssetIdentifier identifier, int _idx) {
getIndex(this.identifier, _idx, () -> identifier.toBuilder());
return this;
}
@Override
public InflationIndex.InflationIndexBuilder addIdentifier(List extends AssetIdentifier> identifiers) {
if (identifiers != null) {
for (AssetIdentifier toAdd : identifiers) {
this.identifier.add(toAdd.toBuilder());
}
}
return this;
}
@Override
@RosettaAttribute("identifier")
public InflationIndex.InflationIndexBuilder setIdentifier(List extends AssetIdentifier> identifiers) {
if (identifiers == null) {
this.identifier = new ArrayList<>();
}
else {
this.identifier = identifiers.stream()
.map(_a->_a.toBuilder())
.collect(Collectors.toCollection(()->new ArrayList<>()));
}
return this;
}
@Override
public InflationIndex.InflationIndexBuilder addTaxonomy(Taxonomy taxonomy) {
if (taxonomy!=null) this.taxonomy.add(taxonomy.toBuilder());
return this;
}
@Override
public InflationIndex.InflationIndexBuilder addTaxonomy(Taxonomy taxonomy, int _idx) {
getIndex(this.taxonomy, _idx, () -> taxonomy.toBuilder());
return this;
}
@Override
public InflationIndex.InflationIndexBuilder addTaxonomy(List extends Taxonomy> taxonomys) {
if (taxonomys != null) {
for (Taxonomy toAdd : taxonomys) {
this.taxonomy.add(toAdd.toBuilder());
}
}
return this;
}
@Override
@RosettaAttribute("taxonomy")
public InflationIndex.InflationIndexBuilder setTaxonomy(List extends Taxonomy> taxonomys) {
if (taxonomys == null) {
this.taxonomy = new ArrayList<>();
}
else {
this.taxonomy = taxonomys.stream()
.map(_a->_a.toBuilder())
.collect(Collectors.toCollection(()->new ArrayList<>()));
}
return this;
}
@Override
@RosettaAttribute("isExchangeListed")
public InflationIndex.InflationIndexBuilder setIsExchangeListed(Boolean isExchangeListed) {
this.isExchangeListed = isExchangeListed==null?null:isExchangeListed;
return this;
}
@Override
@RosettaAttribute("exchange")
public InflationIndex.InflationIndexBuilder setExchange(LegalEntity exchange) {
this.exchange = exchange==null?null:exchange.toBuilder();
return this;
}
@Override
public InflationIndex.InflationIndexBuilder addRelatedExchange(LegalEntity relatedExchange) {
if (relatedExchange!=null) this.relatedExchange.add(relatedExchange.toBuilder());
return this;
}
@Override
public InflationIndex.InflationIndexBuilder addRelatedExchange(LegalEntity relatedExchange, int _idx) {
getIndex(this.relatedExchange, _idx, () -> relatedExchange.toBuilder());
return this;
}
@Override
public InflationIndex.InflationIndexBuilder addRelatedExchange(List extends LegalEntity> relatedExchanges) {
if (relatedExchanges != null) {
for (LegalEntity toAdd : relatedExchanges) {
this.relatedExchange.add(toAdd.toBuilder());
}
}
return this;
}
@Override
@RosettaAttribute("relatedExchange")
public InflationIndex.InflationIndexBuilder setRelatedExchange(List extends LegalEntity> relatedExchanges) {
if (relatedExchanges == null) {
this.relatedExchange = new ArrayList<>();
}
else {
this.relatedExchange = relatedExchanges.stream()
.map(_a->_a.toBuilder())
.collect(Collectors.toCollection(()->new ArrayList<>()));
}
return this;
}
@Override
@RosettaAttribute("name")
public InflationIndex.InflationIndexBuilder setName(String name) {
this.name = name==null?null:name;
return this;
}
@Override
@RosettaAttribute("provider")
public InflationIndex.InflationIndexBuilder setProvider(LegalEntity provider) {
this.provider = provider==null?null:provider.toBuilder();
return this;
}
@Override
@RosettaAttribute("assetClass")
public InflationIndex.InflationIndexBuilder setAssetClass(AssetClassEnum assetClass) {
this.assetClass = assetClass==null?null:assetClass;
return this;
}
@Override
@RosettaAttribute("inflationRateIndex")
public InflationIndex.InflationIndexBuilder setInflationRateIndex(FieldWithMetaInflationRateIndexEnum inflationRateIndex) {
this.inflationRateIndex = inflationRateIndex==null?null:inflationRateIndex.toBuilder();
return this;
}
@Override
public InflationIndex.InflationIndexBuilder setInflationRateIndexValue(InflationRateIndexEnum inflationRateIndex) {
this.getOrCreateInflationRateIndex().setValue(inflationRateIndex);
return this;
}
@Override
public InflationIndex build() {
return new InflationIndex.InflationIndexImpl(this);
}
@Override
public InflationIndex.InflationIndexBuilder toBuilder() {
return this;
}
@SuppressWarnings("unchecked")
@Override
public InflationIndex.InflationIndexBuilder prune() {
super.prune();
if (inflationRateIndex!=null && !inflationRateIndex.prune().hasData()) inflationRateIndex = null;
return this;
}
@Override
public boolean hasData() {
if (super.hasData()) return true;
if (getInflationRateIndex()!=null) return true;
return false;
}
@SuppressWarnings("unchecked")
@Override
public InflationIndex.InflationIndexBuilder merge(RosettaModelObjectBuilder other, BuilderMerger merger) {
super.merge(other, merger);
InflationIndex.InflationIndexBuilder o = (InflationIndex.InflationIndexBuilder) other;
merger.mergeRosetta(getInflationRateIndex(), o.getInflationRateIndex(), this::setInflationRateIndex);
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;
if (!super.equals(o)) return false;
InflationIndex _that = getType().cast(o);
if (!Objects.equals(inflationRateIndex, _that.getInflationRateIndex())) return false;
return true;
}
@Override
public int hashCode() {
int _result = super.hashCode();
_result = 31 * _result + (inflationRateIndex != null ? inflationRateIndex.getClass().getName().hashCode() : 0);
return _result;
}
@Override
public String toString() {
return "InflationIndexBuilder {" +
"inflationRateIndex=" + this.inflationRateIndex +
'}' + " " + super.toString();
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy