/** * Copyright (C) 2012 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.opengamma.financial.spring; 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.DirectBeanBuilder; import org.joda.beans.impl.direct.DirectMetaProperty; import org.joda.beans.impl.direct.DirectMetaPropertyMap; import com.opengamma.core.config.ConfigSource; import com.opengamma.master.historicaltimeseries.HistoricalTimeSeriesMaster; import com.opengamma.master.historicaltimeseries.HistoricalTimeSeriesResolver; import com.opengamma.master.historicaltimeseries.impl.DefaultHistoricalTimeSeriesResolver; import com.opengamma.master.historicaltimeseries.impl.DefaultHistoricalTimeSeriesSelector; import com.opengamma.util.spring.SpringFactoryBean; /** * Spring factory bean for {@link DefaultHistoricalTimeSeriesResolver}. */ @BeanDefinition public class DefaultHistoricalTimeSeriesResolverFactoryBean extends SpringFactoryBean<HistoricalTimeSeriesResolver> { /** * The HTS master. */ @PropertyDefinition private HistoricalTimeSeriesMaster _historicalTimeSeriesMaster; /** * The config source. */ @PropertyDefinition private ConfigSource _configSource; /** * Creates an instance. */ public DefaultHistoricalTimeSeriesResolverFactoryBean() { super(HistoricalTimeSeriesResolver.class); } //------------------------------------------------------------------------- @Override protected HistoricalTimeSeriesResolver createObject() { DefaultHistoricalTimeSeriesSelector selector = new DefaultHistoricalTimeSeriesSelector(getConfigSource()); return new DefaultHistoricalTimeSeriesResolver(selector, getHistoricalTimeSeriesMaster()); } //------------------------- AUTOGENERATED START ------------------------- ///CLOVER:OFF /** * The meta-bean for {@code DefaultHistoricalTimeSeriesResolverFactoryBean}. * @return the meta-bean, not null */ public static DefaultHistoricalTimeSeriesResolverFactoryBean.Meta meta() { return DefaultHistoricalTimeSeriesResolverFactoryBean.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(DefaultHistoricalTimeSeriesResolverFactoryBean.Meta.INSTANCE); } @Override public DefaultHistoricalTimeSeriesResolverFactoryBean.Meta metaBean() { return DefaultHistoricalTimeSeriesResolverFactoryBean.Meta.INSTANCE; } //----------------------------------------------------------------------- /** * Gets the HTS master. * @return the value of the property */ public HistoricalTimeSeriesMaster getHistoricalTimeSeriesMaster() { return _historicalTimeSeriesMaster; } /** * Sets the HTS master. * @param historicalTimeSeriesMaster the new value of the property */ public void setHistoricalTimeSeriesMaster(HistoricalTimeSeriesMaster historicalTimeSeriesMaster) { this._historicalTimeSeriesMaster = historicalTimeSeriesMaster; } /** * Gets the the {@code historicalTimeSeriesMaster} property. * @return the property, not null */ public final Property<HistoricalTimeSeriesMaster> historicalTimeSeriesMaster() { return metaBean().historicalTimeSeriesMaster().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the config source. * @return the value of the property */ public ConfigSource getConfigSource() { return _configSource; } /** * Sets the config source. * @param configSource the new value of the property */ public void setConfigSource(ConfigSource configSource) { this._configSource = configSource; } /** * Gets the the {@code configSource} property. * @return the property, not null */ public final Property<ConfigSource> configSource() { return metaBean().configSource().createProperty(this); } //----------------------------------------------------------------------- @Override public DefaultHistoricalTimeSeriesResolverFactoryBean clone() { return JodaBeanUtils.cloneAlways(this); } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj != null && obj.getClass() == this.getClass()) { DefaultHistoricalTimeSeriesResolverFactoryBean other = (DefaultHistoricalTimeSeriesResolverFactoryBean) obj; return JodaBeanUtils.equal(getHistoricalTimeSeriesMaster(), other.getHistoricalTimeSeriesMaster()) && JodaBeanUtils.equal(getConfigSource(), other.getConfigSource()) && super.equals(obj); } return false; } @Override public int hashCode() { int hash = 7; hash = hash * 31 + JodaBeanUtils.hashCode(getHistoricalTimeSeriesMaster()); hash = hash * 31 + JodaBeanUtils.hashCode(getConfigSource()); return hash ^ super.hashCode(); } @Override public String toString() { StringBuilder buf = new StringBuilder(96); buf.append("DefaultHistoricalTimeSeriesResolverFactoryBean{"); int len = buf.length(); toString(buf); if (buf.length() > len) { buf.setLength(buf.length() - 2); } buf.append('}'); return buf.toString(); } @Override protected void toString(StringBuilder buf) { super.toString(buf); buf.append("historicalTimeSeriesMaster").append('=').append(JodaBeanUtils.toString(getHistoricalTimeSeriesMaster())).append(',').append(' '); buf.append("configSource").append('=').append(JodaBeanUtils.toString(getConfigSource())).append(',').append(' '); } //----------------------------------------------------------------------- /** * The meta-bean for {@code DefaultHistoricalTimeSeriesResolverFactoryBean}. */ public static class Meta extends SpringFactoryBean.Meta<HistoricalTimeSeriesResolver> { /** * The singleton instance of the meta-bean. */ static final Meta INSTANCE = new Meta(); /** * The meta-property for the {@code historicalTimeSeriesMaster} property. */ private final MetaProperty<HistoricalTimeSeriesMaster> _historicalTimeSeriesMaster = DirectMetaProperty.ofReadWrite( this, "historicalTimeSeriesMaster", DefaultHistoricalTimeSeriesResolverFactoryBean.class, HistoricalTimeSeriesMaster.class); /** * The meta-property for the {@code configSource} property. */ private final MetaProperty<ConfigSource> _configSource = DirectMetaProperty.ofReadWrite( this, "configSource", DefaultHistoricalTimeSeriesResolverFactoryBean.class, ConfigSource.class); /** * The meta-properties. */ private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap( this, (DirectMetaPropertyMap) super.metaPropertyMap(), "historicalTimeSeriesMaster", "configSource"); /** * Restricted constructor. */ protected Meta() { } @Override protected MetaProperty<?> metaPropertyGet(String propertyName) { switch (propertyName.hashCode()) { case 173967376: // historicalTimeSeriesMaster return _historicalTimeSeriesMaster; case 195157501: // configSource return _configSource; } return super.metaPropertyGet(propertyName); } @Override public BeanBuilder<? extends DefaultHistoricalTimeSeriesResolverFactoryBean> builder() { return new DirectBeanBuilder<DefaultHistoricalTimeSeriesResolverFactoryBean>(new DefaultHistoricalTimeSeriesResolverFactoryBean()); } @Override public Class<? extends DefaultHistoricalTimeSeriesResolverFactoryBean> beanType() { return DefaultHistoricalTimeSeriesResolverFactoryBean.class; } @Override public Map<String, MetaProperty<?>> metaPropertyMap() { return _metaPropertyMap$; } //----------------------------------------------------------------------- /** * The meta-property for the {@code historicalTimeSeriesMaster} property. * @return the meta-property, not null */ public final MetaProperty<HistoricalTimeSeriesMaster> historicalTimeSeriesMaster() { return _historicalTimeSeriesMaster; } /** * The meta-property for the {@code configSource} property. * @return the meta-property, not null */ public final MetaProperty<ConfigSource> configSource() { return _configSource; } //----------------------------------------------------------------------- @Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 173967376: // historicalTimeSeriesMaster return ((DefaultHistoricalTimeSeriesResolverFactoryBean) bean).getHistoricalTimeSeriesMaster(); case 195157501: // configSource return ((DefaultHistoricalTimeSeriesResolverFactoryBean) bean).getConfigSource(); } return super.propertyGet(bean, propertyName, quiet); } @Override protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) { switch (propertyName.hashCode()) { case 173967376: // historicalTimeSeriesMaster ((DefaultHistoricalTimeSeriesResolverFactoryBean) bean).setHistoricalTimeSeriesMaster((HistoricalTimeSeriesMaster) newValue); return; case 195157501: // configSource ((DefaultHistoricalTimeSeriesResolverFactoryBean) bean).setConfigSource((ConfigSource) newValue); return; } super.propertySet(bean, propertyName, newValue, quiet); } } ///CLOVER:ON //-------------------------- AUTOGENERATED END -------------------------- }