/**
* Copyright (C) 2012 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.financial.security.cds;
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.financial.security.FinancialSecurity;
import com.opengamma.financial.security.FinancialSecurityVisitor;
import com.opengamma.master.security.SecurityDescription;
import com.opengamma.util.money.Currency;
/**
* A security for Credit Default Swap Index Definitions. These will then be used as
* the "underlying" security for individual Credit Default Swap Index securities.
*/
@BeanDefinition
@SecurityDescription(type = CreditDefaultSwapIndexDefinitionSecurity.SECURITY_TYPE, description = "Cds index definition")
public class CreditDefaultSwapIndexDefinitionSecurity extends FinancialSecurity {
/** Serialization version. */
private static final long serialVersionUID = 1L;
/**
* The security type.
*/
public static final String SECURITY_TYPE = "CDS_INDEX_DEFINITION";
/**
* The version number.
*/
@PropertyDefinition(validate = "notNull")
private String _version;
/**
* The series number.
*/
@PropertyDefinition(validate = "notNull")
private String _series;
/**
* The family
*/
@PropertyDefinition(validate = "notNull")
private String _family;
/**
* The currency.
*/
@PropertyDefinition(validate = "notNull")
private Currency _currency;
/**
* The recovery rate for the index.
*/
@PropertyDefinition(validate = "notNull")
private Double _recoveryRate;
/**
* The terms.
*/
@PropertyDefinition(validate = "notNull")
private CDSIndexTerms _terms;
/**
* The index components.
*/
@PropertyDefinition(validate = "notNull")
private CDSIndexComponentBundle _components;
/**
* Creates an instance
*/
CreditDefaultSwapIndexDefinitionSecurity() { //For builder
super(SECURITY_TYPE);
}
/**
* Creates an instance.
*
* @param version the version, not null
* @param series the series, not null
* @param family the family, not null
* @param currency the currency, not null
* @param recoveryRate the recovery rate for the index, not null
* @param terms the terms, not null
* @param components the components, not null
*/
public CreditDefaultSwapIndexDefinitionSecurity(String version,
String series,
String family,
Currency currency,
Double recoveryRate,
CDSIndexTerms terms,
CDSIndexComponentBundle components) {
super(SECURITY_TYPE);
setVersion(version);
setSeries(series);
setFamily(family);
setCurrency(currency);
setRecoveryRate(recoveryRate);
setTerms(terms);
setComponents(components);
}
@Override
public <T> T accept(FinancialSecurityVisitor<T> visitor) {
return visitor.visitCreditDefaultSwapIndexDefinitionSecurity(this);
}
//------------------------- AUTOGENERATED START -------------------------
///CLOVER:OFF
/**
* The meta-bean for {@code CreditDefaultSwapIndexDefinitionSecurity}.
* @return the meta-bean, not null
*/
public static CreditDefaultSwapIndexDefinitionSecurity.Meta meta() {
return CreditDefaultSwapIndexDefinitionSecurity.Meta.INSTANCE;
}
static {
JodaBeanUtils.registerMetaBean(CreditDefaultSwapIndexDefinitionSecurity.Meta.INSTANCE);
}
@Override
public CreditDefaultSwapIndexDefinitionSecurity.Meta metaBean() {
return CreditDefaultSwapIndexDefinitionSecurity.Meta.INSTANCE;
}
//-----------------------------------------------------------------------
/**
* Gets the version number.
* @return the value of the property, not null
*/
public String getVersion() {
return _version;
}
/**
* Sets the version number.
* @param version the new value of the property, not null
*/
public void setVersion(String version) {
JodaBeanUtils.notNull(version, "version");
this._version = version;
}
/**
* Gets the the {@code version} property.
* @return the property, not null
*/
public final Property<String> version() {
return metaBean().version().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the series number.
* @return the value of the property, not null
*/
public String getSeries() {
return _series;
}
/**
* Sets the series number.
* @param series the new value of the property, not null
*/
public void setSeries(String series) {
JodaBeanUtils.notNull(series, "series");
this._series = series;
}
/**
* Gets the the {@code series} property.
* @return the property, not null
*/
public final Property<String> series() {
return metaBean().series().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the family
* @return the value of the property, not null
*/
public String getFamily() {
return _family;
}
/**
* Sets the family
* @param family the new value of the property, not null
*/
public void setFamily(String family) {
JodaBeanUtils.notNull(family, "family");
this._family = family;
}
/**
* Gets the the {@code family} property.
* @return the property, not null
*/
public final Property<String> family() {
return metaBean().family().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the currency.
* @return the value of the property, not null
*/
public Currency getCurrency() {
return _currency;
}
/**
* Sets the currency.
* @param currency the new value of the property, not null
*/
public void setCurrency(Currency currency) {
JodaBeanUtils.notNull(currency, "currency");
this._currency = currency;
}
/**
* Gets the the {@code currency} property.
* @return the property, not null
*/
public final Property<Currency> currency() {
return metaBean().currency().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the recovery rate for the index.
* @return the value of the property, not null
*/
public Double getRecoveryRate() {
return _recoveryRate;
}
/**
* Sets the recovery rate for the index.
* @param recoveryRate the new value of the property, not null
*/
public void setRecoveryRate(Double recoveryRate) {
JodaBeanUtils.notNull(recoveryRate, "recoveryRate");
this._recoveryRate = recoveryRate;
}
/**
* Gets the the {@code recoveryRate} property.
* @return the property, not null
*/
public final Property<Double> recoveryRate() {
return metaBean().recoveryRate().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the terms.
* @return the value of the property, not null
*/
public CDSIndexTerms getTerms() {
return _terms;
}
/**
* Sets the terms.
* @param terms the new value of the property, not null
*/
public void setTerms(CDSIndexTerms terms) {
JodaBeanUtils.notNull(terms, "terms");
this._terms = terms;
}
/**
* Gets the the {@code terms} property.
* @return the property, not null
*/
public final Property<CDSIndexTerms> terms() {
return metaBean().terms().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the index components.
* @return the value of the property, not null
*/
public CDSIndexComponentBundle getComponents() {
return _components;
}
/**
* Sets the index components.
* @param components the new value of the property, not null
*/
public void setComponents(CDSIndexComponentBundle components) {
JodaBeanUtils.notNull(components, "components");
this._components = components;
}
/**
* Gets the the {@code components} property.
* @return the property, not null
*/
public final Property<CDSIndexComponentBundle> components() {
return metaBean().components().createProperty(this);
}
//-----------------------------------------------------------------------
@Override
public CreditDefaultSwapIndexDefinitionSecurity clone() {
return JodaBeanUtils.cloneAlways(this);
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj != null && obj.getClass() == this.getClass()) {
CreditDefaultSwapIndexDefinitionSecurity other = (CreditDefaultSwapIndexDefinitionSecurity) obj;
return JodaBeanUtils.equal(getVersion(), other.getVersion()) &&
JodaBeanUtils.equal(getSeries(), other.getSeries()) &&
JodaBeanUtils.equal(getFamily(), other.getFamily()) &&
JodaBeanUtils.equal(getCurrency(), other.getCurrency()) &&
JodaBeanUtils.equal(getRecoveryRate(), other.getRecoveryRate()) &&
JodaBeanUtils.equal(getTerms(), other.getTerms()) &&
JodaBeanUtils.equal(getComponents(), other.getComponents()) &&
super.equals(obj);
}
return false;
}
@Override
public int hashCode() {
int hash = 7;
hash = hash * 31 + JodaBeanUtils.hashCode(getVersion());
hash = hash * 31 + JodaBeanUtils.hashCode(getSeries());
hash = hash * 31 + JodaBeanUtils.hashCode(getFamily());
hash = hash * 31 + JodaBeanUtils.hashCode(getCurrency());
hash = hash * 31 + JodaBeanUtils.hashCode(getRecoveryRate());
hash = hash * 31 + JodaBeanUtils.hashCode(getTerms());
hash = hash * 31 + JodaBeanUtils.hashCode(getComponents());
return hash ^ super.hashCode();
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(256);
buf.append("CreditDefaultSwapIndexDefinitionSecurity{");
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("version").append('=').append(JodaBeanUtils.toString(getVersion())).append(',').append(' ');
buf.append("series").append('=').append(JodaBeanUtils.toString(getSeries())).append(',').append(' ');
buf.append("family").append('=').append(JodaBeanUtils.toString(getFamily())).append(',').append(' ');
buf.append("currency").append('=').append(JodaBeanUtils.toString(getCurrency())).append(',').append(' ');
buf.append("recoveryRate").append('=').append(JodaBeanUtils.toString(getRecoveryRate())).append(',').append(' ');
buf.append("terms").append('=').append(JodaBeanUtils.toString(getTerms())).append(',').append(' ');
buf.append("components").append('=').append(JodaBeanUtils.toString(getComponents())).append(',').append(' ');
}
//-----------------------------------------------------------------------
/**
* The meta-bean for {@code CreditDefaultSwapIndexDefinitionSecurity}.
*/
public static class Meta extends FinancialSecurity.Meta {
/**
* The singleton instance of the meta-bean.
*/
static final Meta INSTANCE = new Meta();
/**
* The meta-property for the {@code version} property.
*/
private final MetaProperty<String> _version = DirectMetaProperty.ofReadWrite(
this, "version", CreditDefaultSwapIndexDefinitionSecurity.class, String.class);
/**
* The meta-property for the {@code series} property.
*/
private final MetaProperty<String> _series = DirectMetaProperty.ofReadWrite(
this, "series", CreditDefaultSwapIndexDefinitionSecurity.class, String.class);
/**
* The meta-property for the {@code family} property.
*/
private final MetaProperty<String> _family = DirectMetaProperty.ofReadWrite(
this, "family", CreditDefaultSwapIndexDefinitionSecurity.class, String.class);
/**
* The meta-property for the {@code currency} property.
*/
private final MetaProperty<Currency> _currency = DirectMetaProperty.ofReadWrite(
this, "currency", CreditDefaultSwapIndexDefinitionSecurity.class, Currency.class);
/**
* The meta-property for the {@code recoveryRate} property.
*/
private final MetaProperty<Double> _recoveryRate = DirectMetaProperty.ofReadWrite(
this, "recoveryRate", CreditDefaultSwapIndexDefinitionSecurity.class, Double.class);
/**
* The meta-property for the {@code terms} property.
*/
private final MetaProperty<CDSIndexTerms> _terms = DirectMetaProperty.ofReadWrite(
this, "terms", CreditDefaultSwapIndexDefinitionSecurity.class, CDSIndexTerms.class);
/**
* The meta-property for the {@code components} property.
*/
private final MetaProperty<CDSIndexComponentBundle> _components = DirectMetaProperty.ofReadWrite(
this, "components", CreditDefaultSwapIndexDefinitionSecurity.class, CDSIndexComponentBundle.class);
/**
* The meta-properties.
*/
private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap(
this, (DirectMetaPropertyMap) super.metaPropertyMap(),
"version",
"series",
"family",
"currency",
"recoveryRate",
"terms",
"components");
/**
* Restricted constructor.
*/
protected Meta() {
}
@Override
protected MetaProperty<?> metaPropertyGet(String propertyName) {
switch (propertyName.hashCode()) {
case 351608024: // version
return _version;
case -905838985: // series
return _series;
case -1281860764: // family
return _family;
case 575402001: // currency
return _currency;
case 2002873877: // recoveryRate
return _recoveryRate;
case 110250375: // terms
return _terms;
case -447446250: // components
return _components;
}
return super.metaPropertyGet(propertyName);
}
@Override
public BeanBuilder<? extends CreditDefaultSwapIndexDefinitionSecurity> builder() {
return new DirectBeanBuilder<CreditDefaultSwapIndexDefinitionSecurity>(new CreditDefaultSwapIndexDefinitionSecurity());
}
@Override
public Class<? extends CreditDefaultSwapIndexDefinitionSecurity> beanType() {
return CreditDefaultSwapIndexDefinitionSecurity.class;
}
@Override
public Map<String, MetaProperty<?>> metaPropertyMap() {
return _metaPropertyMap$;
}
//-----------------------------------------------------------------------
/**
* The meta-property for the {@code version} property.
* @return the meta-property, not null
*/
public final MetaProperty<String> version() {
return _version;
}
/**
* The meta-property for the {@code series} property.
* @return the meta-property, not null
*/
public final MetaProperty<String> series() {
return _series;
}
/**
* The meta-property for the {@code family} property.
* @return the meta-property, not null
*/
public final MetaProperty<String> family() {
return _family;
}
/**
* The meta-property for the {@code currency} property.
* @return the meta-property, not null
*/
public final MetaProperty<Currency> currency() {
return _currency;
}
/**
* The meta-property for the {@code recoveryRate} property.
* @return the meta-property, not null
*/
public final MetaProperty<Double> recoveryRate() {
return _recoveryRate;
}
/**
* The meta-property for the {@code terms} property.
* @return the meta-property, not null
*/
public final MetaProperty<CDSIndexTerms> terms() {
return _terms;
}
/**
* The meta-property for the {@code components} property.
* @return the meta-property, not null
*/
public final MetaProperty<CDSIndexComponentBundle> components() {
return _components;
}
//-----------------------------------------------------------------------
@Override
protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {
switch (propertyName.hashCode()) {
case 351608024: // version
return ((CreditDefaultSwapIndexDefinitionSecurity) bean).getVersion();
case -905838985: // series
return ((CreditDefaultSwapIndexDefinitionSecurity) bean).getSeries();
case -1281860764: // family
return ((CreditDefaultSwapIndexDefinitionSecurity) bean).getFamily();
case 575402001: // currency
return ((CreditDefaultSwapIndexDefinitionSecurity) bean).getCurrency();
case 2002873877: // recoveryRate
return ((CreditDefaultSwapIndexDefinitionSecurity) bean).getRecoveryRate();
case 110250375: // terms
return ((CreditDefaultSwapIndexDefinitionSecurity) bean).getTerms();
case -447446250: // components
return ((CreditDefaultSwapIndexDefinitionSecurity) bean).getComponents();
}
return super.propertyGet(bean, propertyName, quiet);
}
@Override
protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {
switch (propertyName.hashCode()) {
case 351608024: // version
((CreditDefaultSwapIndexDefinitionSecurity) bean).setVersion((String) newValue);
return;
case -905838985: // series
((CreditDefaultSwapIndexDefinitionSecurity) bean).setSeries((String) newValue);
return;
case -1281860764: // family
((CreditDefaultSwapIndexDefinitionSecurity) bean).setFamily((String) newValue);
return;
case 575402001: // currency
((CreditDefaultSwapIndexDefinitionSecurity) bean).setCurrency((Currency) newValue);
return;
case 2002873877: // recoveryRate
((CreditDefaultSwapIndexDefinitionSecurity) bean).setRecoveryRate((Double) newValue);
return;
case 110250375: // terms
((CreditDefaultSwapIndexDefinitionSecurity) bean).setTerms((CDSIndexTerms) newValue);
return;
case -447446250: // components
((CreditDefaultSwapIndexDefinitionSecurity) bean).setComponents((CDSIndexComponentBundle) newValue);
return;
}
super.propertySet(bean, propertyName, newValue, quiet);
}
@Override
protected void validate(Bean bean) {
JodaBeanUtils.notNull(((CreditDefaultSwapIndexDefinitionSecurity) bean)._version, "version");
JodaBeanUtils.notNull(((CreditDefaultSwapIndexDefinitionSecurity) bean)._series, "series");
JodaBeanUtils.notNull(((CreditDefaultSwapIndexDefinitionSecurity) bean)._family, "family");
JodaBeanUtils.notNull(((CreditDefaultSwapIndexDefinitionSecurity) bean)._currency, "currency");
JodaBeanUtils.notNull(((CreditDefaultSwapIndexDefinitionSecurity) bean)._recoveryRate, "recoveryRate");
JodaBeanUtils.notNull(((CreditDefaultSwapIndexDefinitionSecurity) bean)._terms, "terms");
JodaBeanUtils.notNull(((CreditDefaultSwapIndexDefinitionSecurity) bean)._components, "components");
super.validate(bean);
}
}
///CLOVER:ON
//-------------------------- AUTOGENERATED END --------------------------
}