/**
* Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.provider.historicaltimeseries;
import java.util.Map;
import java.util.Set;
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 com.google.common.collect.Maps;
import com.opengamma.id.ExternalIdBundle;
import com.opengamma.timeseries.date.localdate.LocalDateDoubleTimeSeries;
import com.opengamma.util.PublicSPI;
/**
* Result from getting one or more historical time-series.
* <p>
* This class is mutable and not thread-safe.
*/
@PublicSPI
@BeanDefinition
public class HistoricalTimeSeriesProviderGetResult extends DirectBean {
/**
* The time-series that were obtained.
*/
@PropertyDefinition
private final Map<ExternalIdBundle, LocalDateDoubleTimeSeries> _resultMap = Maps.newHashMap();
/**
* The time-series permissions that were obtained.
*/
@PropertyDefinition
private final Map<ExternalIdBundle, Set<String>> _permissionsMap = Maps.newHashMap();
/**
* Creates an instance.
*/
public HistoricalTimeSeriesProviderGetResult() {
}
/**
* Creates an instance.
*
* @param result the map of results, not null
*/
public HistoricalTimeSeriesProviderGetResult(Map<ExternalIdBundle, LocalDateDoubleTimeSeries> result) {
setResultMap(result);
}
/**
* Creates an instance.
*
* @param result the map of results, not null
* @param permissions the permissions
*/
public HistoricalTimeSeriesProviderGetResult(Map<ExternalIdBundle, LocalDateDoubleTimeSeries> result, Map<ExternalIdBundle, Set<String>> permissions) {
setResultMap(result);
setPermissionsMap(permissions);
}
//------------------------- AUTOGENERATED START -------------------------
///CLOVER:OFF
/**
* The meta-bean for {@code HistoricalTimeSeriesProviderGetResult}.
* @return the meta-bean, not null
*/
public static HistoricalTimeSeriesProviderGetResult.Meta meta() {
return HistoricalTimeSeriesProviderGetResult.Meta.INSTANCE;
}
static {
JodaBeanUtils.registerMetaBean(HistoricalTimeSeriesProviderGetResult.Meta.INSTANCE);
}
@Override
public HistoricalTimeSeriesProviderGetResult.Meta metaBean() {
return HistoricalTimeSeriesProviderGetResult.Meta.INSTANCE;
}
//-----------------------------------------------------------------------
/**
* Gets the time-series that were obtained.
* @return the value of the property, not null
*/
public Map<ExternalIdBundle, LocalDateDoubleTimeSeries> getResultMap() {
return _resultMap;
}
/**
* Sets the time-series that were obtained.
* @param resultMap the new value of the property, not null
*/
public void setResultMap(Map<ExternalIdBundle, LocalDateDoubleTimeSeries> resultMap) {
JodaBeanUtils.notNull(resultMap, "resultMap");
this._resultMap.clear();
this._resultMap.putAll(resultMap);
}
/**
* Gets the the {@code resultMap} property.
* @return the property, not null
*/
public final Property<Map<ExternalIdBundle, LocalDateDoubleTimeSeries>> resultMap() {
return metaBean().resultMap().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the time-series permissions that were obtained.
* @return the value of the property, not null
*/
public Map<ExternalIdBundle, Set<String>> getPermissionsMap() {
return _permissionsMap;
}
/**
* Sets the time-series permissions that were obtained.
* @param permissionsMap the new value of the property, not null
*/
public void setPermissionsMap(Map<ExternalIdBundle, Set<String>> permissionsMap) {
JodaBeanUtils.notNull(permissionsMap, "permissionsMap");
this._permissionsMap.clear();
this._permissionsMap.putAll(permissionsMap);
}
/**
* Gets the the {@code permissionsMap} property.
* @return the property, not null
*/
public final Property<Map<ExternalIdBundle, Set<String>>> permissionsMap() {
return metaBean().permissionsMap().createProperty(this);
}
//-----------------------------------------------------------------------
@Override
public HistoricalTimeSeriesProviderGetResult clone() {
return JodaBeanUtils.cloneAlways(this);
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj != null && obj.getClass() == this.getClass()) {
HistoricalTimeSeriesProviderGetResult other = (HistoricalTimeSeriesProviderGetResult) obj;
return JodaBeanUtils.equal(getResultMap(), other.getResultMap()) &&
JodaBeanUtils.equal(getPermissionsMap(), other.getPermissionsMap());
}
return false;
}
@Override
public int hashCode() {
int hash = getClass().hashCode();
hash = hash * 31 + JodaBeanUtils.hashCode(getResultMap());
hash = hash * 31 + JodaBeanUtils.hashCode(getPermissionsMap());
return hash;
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(96);
buf.append("HistoricalTimeSeriesProviderGetResult{");
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("resultMap").append('=').append(JodaBeanUtils.toString(getResultMap())).append(',').append(' ');
buf.append("permissionsMap").append('=').append(JodaBeanUtils.toString(getPermissionsMap())).append(',').append(' ');
}
//-----------------------------------------------------------------------
/**
* The meta-bean for {@code HistoricalTimeSeriesProviderGetResult}.
*/
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 resultMap} property.
*/
@SuppressWarnings({"unchecked", "rawtypes" })
private final MetaProperty<Map<ExternalIdBundle, LocalDateDoubleTimeSeries>> _resultMap = DirectMetaProperty.ofReadWrite(
this, "resultMap", HistoricalTimeSeriesProviderGetResult.class, (Class) Map.class);
/**
* The meta-property for the {@code permissionsMap} property.
*/
@SuppressWarnings({"unchecked", "rawtypes" })
private final MetaProperty<Map<ExternalIdBundle, Set<String>>> _permissionsMap = DirectMetaProperty.ofReadWrite(
this, "permissionsMap", HistoricalTimeSeriesProviderGetResult.class, (Class) Map.class);
/**
* The meta-properties.
*/
private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap(
this, null,
"resultMap",
"permissionsMap");
/**
* Restricted constructor.
*/
protected Meta() {
}
@Override
protected MetaProperty<?> metaPropertyGet(String propertyName) {
switch (propertyName.hashCode()) {
case -1819569153: // resultMap
return _resultMap;
case -1437222344: // permissionsMap
return _permissionsMap;
}
return super.metaPropertyGet(propertyName);
}
@Override
public BeanBuilder<? extends HistoricalTimeSeriesProviderGetResult> builder() {
return new DirectBeanBuilder<HistoricalTimeSeriesProviderGetResult>(new HistoricalTimeSeriesProviderGetResult());
}
@Override
public Class<? extends HistoricalTimeSeriesProviderGetResult> beanType() {
return HistoricalTimeSeriesProviderGetResult.class;
}
@Override
public Map<String, MetaProperty<?>> metaPropertyMap() {
return _metaPropertyMap$;
}
//-----------------------------------------------------------------------
/**
* The meta-property for the {@code resultMap} property.
* @return the meta-property, not null
*/
public final MetaProperty<Map<ExternalIdBundle, LocalDateDoubleTimeSeries>> resultMap() {
return _resultMap;
}
/**
* The meta-property for the {@code permissionsMap} property.
* @return the meta-property, not null
*/
public final MetaProperty<Map<ExternalIdBundle, Set<String>>> permissionsMap() {
return _permissionsMap;
}
//-----------------------------------------------------------------------
@Override
protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {
switch (propertyName.hashCode()) {
case -1819569153: // resultMap
return ((HistoricalTimeSeriesProviderGetResult) bean).getResultMap();
case -1437222344: // permissionsMap
return ((HistoricalTimeSeriesProviderGetResult) bean).getPermissionsMap();
}
return super.propertyGet(bean, propertyName, quiet);
}
@SuppressWarnings("unchecked")
@Override
protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {
switch (propertyName.hashCode()) {
case -1819569153: // resultMap
((HistoricalTimeSeriesProviderGetResult) bean).setResultMap((Map<ExternalIdBundle, LocalDateDoubleTimeSeries>) newValue);
return;
case -1437222344: // permissionsMap
((HistoricalTimeSeriesProviderGetResult) bean).setPermissionsMap((Map<ExternalIdBundle, Set<String>>) newValue);
return;
}
super.propertySet(bean, propertyName, newValue, quiet);
}
@Override
protected void validate(Bean bean) {
JodaBeanUtils.notNull(((HistoricalTimeSeriesProviderGetResult) bean)._resultMap, "resultMap");
JodaBeanUtils.notNull(((HistoricalTimeSeriesProviderGetResult) bean)._permissionsMap, "permissionsMap");
}
}
///CLOVER:ON
//-------------------------- AUTOGENERATED END --------------------------
}