/**
* Copyright (C) 2014 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.financial.analytics.surface;
import org.joda.beans.Bean;
import org.joda.beans.BeanDefinition;
import org.joda.beans.PropertyDefinition;
import org.threeten.bp.LocalDate;
import com.opengamma.financial.analytics.volatility.surface.SurfaceInstrumentProvider;
import com.opengamma.id.ExternalId;
import com.opengamma.id.UniqueId;
import com.opengamma.id.UniqueIdentifiable;
import com.opengamma.util.time.Tenor;
import java.util.Map;
import java.util.Set;
import org.joda.beans.BeanBuilder;
import org.joda.beans.JodaBeanUtils;
import org.joda.beans.MetaProperty;
import org.joda.beans.Property;
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;
/**
* Generates Bloomberg tickers for a forward swap surface, with the x axis the time to
* start and the y axis the swap length.
*/
@BeanDefinition
public class ForwardSwapCurveInstrumentProvider implements Bean, SurfaceInstrumentProvider<Tenor, Tenor>, UniqueIdentifiable {
/** Serialization version */
private static final long serialVersionUID = 1L;
/**
* The unique id.
*/
@PropertyDefinition
private UniqueId _uniqueId;
@Override
public ExternalId getInstrument(final Tenor xAxis, final Tenor yAxis) {
return null;
}
@Override
public ExternalId getInstrument(final Tenor xAxis, final Tenor yAxis, final LocalDate surfaceDate) {
return null;
}
@Override
public String getDataFieldName() {
return null;
}
//------------------------- AUTOGENERATED START -------------------------
///CLOVER:OFF
/**
* The meta-bean for {@code ForwardSwapCurveInstrumentProvider}.
* @return the meta-bean, not null
*/
public static ForwardSwapCurveInstrumentProvider.Meta meta() {
return ForwardSwapCurveInstrumentProvider.Meta.INSTANCE;
}
static {
JodaBeanUtils.registerMetaBean(ForwardSwapCurveInstrumentProvider.Meta.INSTANCE);
}
@Override
public ForwardSwapCurveInstrumentProvider.Meta metaBean() {
return ForwardSwapCurveInstrumentProvider.Meta.INSTANCE;
}
@Override
public <R> Property<R> property(String propertyName) {
return metaBean().<R>metaProperty(propertyName).createProperty(this);
}
@Override
public Set<String> propertyNames() {
return metaBean().metaPropertyMap().keySet();
}
//-----------------------------------------------------------------------
/**
* Gets the unique id.
* @return the value of the property
*/
public UniqueId getUniqueId() {
return _uniqueId;
}
/**
* Sets the unique id.
* @param uniqueId the new value of the property
*/
public void setUniqueId(UniqueId uniqueId) {
this._uniqueId = uniqueId;
}
/**
* Gets the the {@code uniqueId} property.
* @return the property, not null
*/
public final Property<UniqueId> uniqueId() {
return metaBean().uniqueId().createProperty(this);
}
//-----------------------------------------------------------------------
@Override
public ForwardSwapCurveInstrumentProvider clone() {
return JodaBeanUtils.cloneAlways(this);
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj != null && obj.getClass() == this.getClass()) {
ForwardSwapCurveInstrumentProvider other = (ForwardSwapCurveInstrumentProvider) obj;
return JodaBeanUtils.equal(getUniqueId(), other.getUniqueId());
}
return false;
}
@Override
public int hashCode() {
int hash = getClass().hashCode();
hash = hash * 31 + JodaBeanUtils.hashCode(getUniqueId());
return hash;
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(64);
buf.append("ForwardSwapCurveInstrumentProvider{");
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(' ');
}
//-----------------------------------------------------------------------
/**
* The meta-bean for {@code ForwardSwapCurveInstrumentProvider}.
*/
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", ForwardSwapCurveInstrumentProvider.class, UniqueId.class);
/**
* The meta-properties.
*/
private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap(
this, null,
"uniqueId");
/**
* Restricted constructor.
*/
protected Meta() {
}
@Override
protected MetaProperty<?> metaPropertyGet(String propertyName) {
switch (propertyName.hashCode()) {
case -294460212: // uniqueId
return _uniqueId;
}
return super.metaPropertyGet(propertyName);
}
@Override
public BeanBuilder<? extends ForwardSwapCurveInstrumentProvider> builder() {
return new DirectBeanBuilder<ForwardSwapCurveInstrumentProvider>(new ForwardSwapCurveInstrumentProvider());
}
@Override
public Class<? extends ForwardSwapCurveInstrumentProvider> beanType() {
return ForwardSwapCurveInstrumentProvider.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;
}
//-----------------------------------------------------------------------
@Override
protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {
switch (propertyName.hashCode()) {
case -294460212: // uniqueId
return ((ForwardSwapCurveInstrumentProvider) bean).getUniqueId();
}
return super.propertyGet(bean, propertyName, quiet);
}
@Override
protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {
switch (propertyName.hashCode()) {
case -294460212: // uniqueId
((ForwardSwapCurveInstrumentProvider) bean).setUniqueId((UniqueId) newValue);
return;
}
super.propertySet(bean, propertyName, newValue, quiet);
}
}
///CLOVER:ON
//-------------------------- AUTOGENERATED END --------------------------
}