/** * Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.opengamma.master.historicaltimeseries; import java.io.Serializable; import java.util.Map; import org.joda.beans.Bean; import org.joda.beans.BeanBuilder; import org.joda.beans.BeanDefinition; import org.joda.beans.JodaBeanUtils; import org.joda.beans.MetaProperty; import org.joda.beans.Property; import org.joda.beans.PropertyDefinition; import org.joda.beans.impl.direct.DirectBean; import org.joda.beans.impl.direct.DirectBeanBuilder; import org.joda.beans.impl.direct.DirectMetaBean; import org.joda.beans.impl.direct.DirectMetaProperty; import org.joda.beans.impl.direct.DirectMetaPropertyMap; import org.threeten.bp.Instant; import com.opengamma.core.historicaltimeseries.HistoricalTimeSeries; import com.opengamma.id.MutableUniqueIdentifiable; import com.opengamma.id.UniqueId; import com.opengamma.id.UniqueIdentifiable; import com.opengamma.timeseries.date.localdate.LocalDateDoubleTimeSeries; import com.opengamma.util.PublicSPI; /** * A time-series as stored in a master. * <p> * The time-series is stored separately from the information describing it. * See {@link ManageableHistoricalTimeSeriesInfo}. * <p> * This class is mutable and not thread-safe. */ @PublicSPI @BeanDefinition public class ManageableHistoricalTimeSeries extends DirectBean implements HistoricalTimeSeries, UniqueIdentifiable, MutableUniqueIdentifiable, Serializable { /** Serialization version. */ private static final long serialVersionUID = 1L; /** * The historical time-series unique identifier. * This field is managed by the master but must be set for updates. */ @PropertyDefinition private UniqueId _uniqueId; /** * The instant that this version was created. */ @PropertyDefinition private Instant _versionInstant; /** * The instant that this version was corrected at. */ @PropertyDefinition private Instant _correctionInstant; /** * The time-series. * This field is only returned if requested from the master, and not all * points are necessarily returned. */ @PropertyDefinition private LocalDateDoubleTimeSeries _timeSeries; /** * Creates an instance. */ public ManageableHistoricalTimeSeries() { } //------------------------- AUTOGENERATED START ------------------------- ///CLOVER:OFF /** * The meta-bean for {@code ManageableHistoricalTimeSeries}. * @return the meta-bean, not null */ public static ManageableHistoricalTimeSeries.Meta meta() { return ManageableHistoricalTimeSeries.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(ManageableHistoricalTimeSeries.Meta.INSTANCE); } @Override public ManageableHistoricalTimeSeries.Meta metaBean() { return ManageableHistoricalTimeSeries.Meta.INSTANCE; } //----------------------------------------------------------------------- /** * Gets the historical time-series unique identifier. * This field is managed by the master but must be set for updates. * @return the value of the property */ public UniqueId getUniqueId() { return _uniqueId; } /** * Sets the historical time-series unique identifier. * This field is managed by the master but must be set for updates. * @param uniqueId the new value of the property */ public void setUniqueId(UniqueId uniqueId) { this._uniqueId = uniqueId; } /** * Gets the the {@code uniqueId} property. * This field is managed by the master but must be set for updates. * @return the property, not null */ public final Property<UniqueId> uniqueId() { return metaBean().uniqueId().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the instant that this version was created. * @return the value of the property */ public Instant getVersionInstant() { return _versionInstant; } /** * Sets the instant that this version was created. * @param versionInstant the new value of the property */ public void setVersionInstant(Instant versionInstant) { this._versionInstant = versionInstant; } /** * Gets the the {@code versionInstant} property. * @return the property, not null */ public final Property<Instant> versionInstant() { return metaBean().versionInstant().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the instant that this version was corrected at. * @return the value of the property */ public Instant getCorrectionInstant() { return _correctionInstant; } /** * Sets the instant that this version was corrected at. * @param correctionInstant the new value of the property */ public void setCorrectionInstant(Instant correctionInstant) { this._correctionInstant = correctionInstant; } /** * Gets the the {@code correctionInstant} property. * @return the property, not null */ public final Property<Instant> correctionInstant() { return metaBean().correctionInstant().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the time-series. * This field is only returned if requested from the master, and not all * points are necessarily returned. * @return the value of the property */ public LocalDateDoubleTimeSeries getTimeSeries() { return _timeSeries; } /** * Sets the time-series. * This field is only returned if requested from the master, and not all * points are necessarily returned. * @param timeSeries the new value of the property */ public void setTimeSeries(LocalDateDoubleTimeSeries timeSeries) { this._timeSeries = timeSeries; } /** * Gets the the {@code timeSeries} property. * This field is only returned if requested from the master, and not all * points are necessarily returned. * @return the property, not null */ public final Property<LocalDateDoubleTimeSeries> timeSeries() { return metaBean().timeSeries().createProperty(this); } //----------------------------------------------------------------------- @Override public ManageableHistoricalTimeSeries clone() { return JodaBeanUtils.cloneAlways(this); } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj != null && obj.getClass() == this.getClass()) { ManageableHistoricalTimeSeries other = (ManageableHistoricalTimeSeries) obj; return JodaBeanUtils.equal(getUniqueId(), other.getUniqueId()) && JodaBeanUtils.equal(getVersionInstant(), other.getVersionInstant()) && JodaBeanUtils.equal(getCorrectionInstant(), other.getCorrectionInstant()) && JodaBeanUtils.equal(getTimeSeries(), other.getTimeSeries()); } return false; } @Override public int hashCode() { int hash = getClass().hashCode(); hash = hash * 31 + JodaBeanUtils.hashCode(getUniqueId()); hash = hash * 31 + JodaBeanUtils.hashCode(getVersionInstant()); hash = hash * 31 + JodaBeanUtils.hashCode(getCorrectionInstant()); hash = hash * 31 + JodaBeanUtils.hashCode(getTimeSeries()); return hash; } @Override public String toString() { StringBuilder buf = new StringBuilder(160); buf.append("ManageableHistoricalTimeSeries{"); int len = buf.length(); toString(buf); if (buf.length() > len) { buf.setLength(buf.length() - 2); } buf.append('}'); return buf.toString(); } protected void toString(StringBuilder buf) { buf.append("uniqueId").append('=').append(JodaBeanUtils.toString(getUniqueId())).append(',').append(' '); buf.append("versionInstant").append('=').append(JodaBeanUtils.toString(getVersionInstant())).append(',').append(' '); buf.append("correctionInstant").append('=').append(JodaBeanUtils.toString(getCorrectionInstant())).append(',').append(' '); buf.append("timeSeries").append('=').append(JodaBeanUtils.toString(getTimeSeries())).append(',').append(' '); } //----------------------------------------------------------------------- /** * The meta-bean for {@code ManageableHistoricalTimeSeries}. */ public static class Meta extends DirectMetaBean { /** * The singleton instance of the meta-bean. */ static final Meta INSTANCE = new Meta(); /** * The meta-property for the {@code uniqueId} property. */ private final MetaProperty<UniqueId> _uniqueId = DirectMetaProperty.ofReadWrite( this, "uniqueId", ManageableHistoricalTimeSeries.class, UniqueId.class); /** * The meta-property for the {@code versionInstant} property. */ private final MetaProperty<Instant> _versionInstant = DirectMetaProperty.ofReadWrite( this, "versionInstant", ManageableHistoricalTimeSeries.class, Instant.class); /** * The meta-property for the {@code correctionInstant} property. */ private final MetaProperty<Instant> _correctionInstant = DirectMetaProperty.ofReadWrite( this, "correctionInstant", ManageableHistoricalTimeSeries.class, Instant.class); /** * The meta-property for the {@code timeSeries} property. */ private final MetaProperty<LocalDateDoubleTimeSeries> _timeSeries = DirectMetaProperty.ofReadWrite( this, "timeSeries", ManageableHistoricalTimeSeries.class, LocalDateDoubleTimeSeries.class); /** * The meta-properties. */ private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap( this, null, "uniqueId", "versionInstant", "correctionInstant", "timeSeries"); /** * Restricted constructor. */ protected Meta() { } @Override protected MetaProperty<?> metaPropertyGet(String propertyName) { switch (propertyName.hashCode()) { case -294460212: // uniqueId return _uniqueId; case 2084044265: // versionInstant return _versionInstant; case 434256035: // correctionInstant return _correctionInstant; case 779431844: // timeSeries return _timeSeries; } return super.metaPropertyGet(propertyName); } @Override public BeanBuilder<? extends ManageableHistoricalTimeSeries> builder() { return new DirectBeanBuilder<ManageableHistoricalTimeSeries>(new ManageableHistoricalTimeSeries()); } @Override public Class<? extends ManageableHistoricalTimeSeries> beanType() { return ManageableHistoricalTimeSeries.class; } @Override public Map<String, MetaProperty<?>> metaPropertyMap() { return _metaPropertyMap$; } //----------------------------------------------------------------------- /** * The meta-property for the {@code uniqueId} property. * @return the meta-property, not null */ public final MetaProperty<UniqueId> uniqueId() { return _uniqueId; } /** * The meta-property for the {@code versionInstant} property. * @return the meta-property, not null */ public final MetaProperty<Instant> versionInstant() { return _versionInstant; } /** * The meta-property for the {@code correctionInstant} property. * @return the meta-property, not null */ public final MetaProperty<Instant> correctionInstant() { return _correctionInstant; } /** * The meta-property for the {@code timeSeries} property. * @return the meta-property, not null */ public final MetaProperty<LocalDateDoubleTimeSeries> timeSeries() { return _timeSeries; } //----------------------------------------------------------------------- @Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case -294460212: // uniqueId return ((ManageableHistoricalTimeSeries) bean).getUniqueId(); case 2084044265: // versionInstant return ((ManageableHistoricalTimeSeries) bean).getVersionInstant(); case 434256035: // correctionInstant return ((ManageableHistoricalTimeSeries) bean).getCorrectionInstant(); case 779431844: // timeSeries return ((ManageableHistoricalTimeSeries) bean).getTimeSeries(); } return super.propertyGet(bean, propertyName, quiet); } @Override protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) { switch (propertyName.hashCode()) { case -294460212: // uniqueId ((ManageableHistoricalTimeSeries) bean).setUniqueId((UniqueId) newValue); return; case 2084044265: // versionInstant ((ManageableHistoricalTimeSeries) bean).setVersionInstant((Instant) newValue); return; case 434256035: // correctionInstant ((ManageableHistoricalTimeSeries) bean).setCorrectionInstant((Instant) newValue); return; case 779431844: // timeSeries ((ManageableHistoricalTimeSeries) bean).setTimeSeries((LocalDateDoubleTimeSeries) newValue); return; } super.propertySet(bean, propertyName, newValue, quiet); } } ///CLOVER:ON //-------------------------- AUTOGENERATED END -------------------------- }