/**
* Copyright (C) 2013 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.masterdb.security.hibernate.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.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.opengamma.financial.security.cds.CreditDefaultSwapIndexComponent;
import com.opengamma.masterdb.security.hibernate.ExternalIdBean;
/**
* A Hibernate bean representation of {@link CreditDefaultSwapIndexComponent}.
*/
@BeanDefinition
public class CDSIndexComponentBean extends DirectBean {
/**
* The obligor identifier
*/
@PropertyDefinition
private ExternalIdBean _obligor;
/**
* The weight
*/
@PropertyDefinition
private Double _weight;
/**
* The bond ref id
*/
@PropertyDefinition
private ExternalIdBean _bondId;
/**
* The name
*/
@PropertyDefinition
private String _name;
//------------------------- AUTOGENERATED START -------------------------
///CLOVER:OFF
/**
* The meta-bean for {@code CDSIndexComponentBean}.
* @return the meta-bean, not null
*/
public static CDSIndexComponentBean.Meta meta() {
return CDSIndexComponentBean.Meta.INSTANCE;
}
static {
JodaBeanUtils.registerMetaBean(CDSIndexComponentBean.Meta.INSTANCE);
}
@Override
public CDSIndexComponentBean.Meta metaBean() {
return CDSIndexComponentBean.Meta.INSTANCE;
}
//-----------------------------------------------------------------------
/**
* Gets the obligor identifier
* @return the value of the property
*/
public ExternalIdBean getObligor() {
return _obligor;
}
/**
* Sets the obligor identifier
* @param obligor the new value of the property
*/
public void setObligor(ExternalIdBean obligor) {
this._obligor = obligor;
}
/**
* Gets the the {@code obligor} property.
* @return the property, not null
*/
public final Property<ExternalIdBean> obligor() {
return metaBean().obligor().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the weight
* @return the value of the property
*/
public Double getWeight() {
return _weight;
}
/**
* Sets the weight
* @param weight the new value of the property
*/
public void setWeight(Double weight) {
this._weight = weight;
}
/**
* Gets the the {@code weight} property.
* @return the property, not null
*/
public final Property<Double> weight() {
return metaBean().weight().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the bond ref id
* @return the value of the property
*/
public ExternalIdBean getBondId() {
return _bondId;
}
/**
* Sets the bond ref id
* @param bondId the new value of the property
*/
public void setBondId(ExternalIdBean bondId) {
this._bondId = bondId;
}
/**
* Gets the the {@code bondId} property.
* @return the property, not null
*/
public final Property<ExternalIdBean> bondId() {
return metaBean().bondId().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the name
* @return the value of the property
*/
public String getName() {
return _name;
}
/**
* Sets the name
* @param name the new value of the property
*/
public void setName(String name) {
this._name = name;
}
/**
* Gets the the {@code name} property.
* @return the property, not null
*/
public final Property<String> name() {
return metaBean().name().createProperty(this);
}
//-----------------------------------------------------------------------
@Override
public CDSIndexComponentBean clone() {
return JodaBeanUtils.cloneAlways(this);
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj != null && obj.getClass() == this.getClass()) {
CDSIndexComponentBean other = (CDSIndexComponentBean) obj;
return JodaBeanUtils.equal(getObligor(), other.getObligor()) &&
JodaBeanUtils.equal(getWeight(), other.getWeight()) &&
JodaBeanUtils.equal(getBondId(), other.getBondId()) &&
JodaBeanUtils.equal(getName(), other.getName());
}
return false;
}
@Override
public int hashCode() {
int hash = getClass().hashCode();
hash = hash * 31 + JodaBeanUtils.hashCode(getObligor());
hash = hash * 31 + JodaBeanUtils.hashCode(getWeight());
hash = hash * 31 + JodaBeanUtils.hashCode(getBondId());
hash = hash * 31 + JodaBeanUtils.hashCode(getName());
return hash;
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(160);
buf.append("CDSIndexComponentBean{");
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("obligor").append('=').append(JodaBeanUtils.toString(getObligor())).append(',').append(' ');
buf.append("weight").append('=').append(JodaBeanUtils.toString(getWeight())).append(',').append(' ');
buf.append("bondId").append('=').append(JodaBeanUtils.toString(getBondId())).append(',').append(' ');
buf.append("name").append('=').append(JodaBeanUtils.toString(getName())).append(',').append(' ');
}
//-----------------------------------------------------------------------
/**
* The meta-bean for {@code CDSIndexComponentBean}.
*/
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 obligor} property.
*/
private final MetaProperty<ExternalIdBean> _obligor = DirectMetaProperty.ofReadWrite(
this, "obligor", CDSIndexComponentBean.class, ExternalIdBean.class);
/**
* The meta-property for the {@code weight} property.
*/
private final MetaProperty<Double> _weight = DirectMetaProperty.ofReadWrite(
this, "weight", CDSIndexComponentBean.class, Double.class);
/**
* The meta-property for the {@code bondId} property.
*/
private final MetaProperty<ExternalIdBean> _bondId = DirectMetaProperty.ofReadWrite(
this, "bondId", CDSIndexComponentBean.class, ExternalIdBean.class);
/**
* The meta-property for the {@code name} property.
*/
private final MetaProperty<String> _name = DirectMetaProperty.ofReadWrite(
this, "name", CDSIndexComponentBean.class, String.class);
/**
* The meta-properties.
*/
private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap(
this, null,
"obligor",
"weight",
"bondId",
"name");
/**
* Restricted constructor.
*/
protected Meta() {
}
@Override
protected MetaProperty<?> metaPropertyGet(String propertyName) {
switch (propertyName.hashCode()) {
case -1657678854: // obligor
return _obligor;
case -791592328: // weight
return _weight;
case -1383424194: // bondId
return _bondId;
case 3373707: // name
return _name;
}
return super.metaPropertyGet(propertyName);
}
@Override
public BeanBuilder<? extends CDSIndexComponentBean> builder() {
return new DirectBeanBuilder<CDSIndexComponentBean>(new CDSIndexComponentBean());
}
@Override
public Class<? extends CDSIndexComponentBean> beanType() {
return CDSIndexComponentBean.class;
}
@Override
public Map<String, MetaProperty<?>> metaPropertyMap() {
return _metaPropertyMap$;
}
//-----------------------------------------------------------------------
/**
* The meta-property for the {@code obligor} property.
* @return the meta-property, not null
*/
public final MetaProperty<ExternalIdBean> obligor() {
return _obligor;
}
/**
* The meta-property for the {@code weight} property.
* @return the meta-property, not null
*/
public final MetaProperty<Double> weight() {
return _weight;
}
/**
* The meta-property for the {@code bondId} property.
* @return the meta-property, not null
*/
public final MetaProperty<ExternalIdBean> bondId() {
return _bondId;
}
/**
* The meta-property for the {@code name} property.
* @return the meta-property, not null
*/
public final MetaProperty<String> name() {
return _name;
}
//-----------------------------------------------------------------------
@Override
protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {
switch (propertyName.hashCode()) {
case -1657678854: // obligor
return ((CDSIndexComponentBean) bean).getObligor();
case -791592328: // weight
return ((CDSIndexComponentBean) bean).getWeight();
case -1383424194: // bondId
return ((CDSIndexComponentBean) bean).getBondId();
case 3373707: // name
return ((CDSIndexComponentBean) bean).getName();
}
return super.propertyGet(bean, propertyName, quiet);
}
@Override
protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {
switch (propertyName.hashCode()) {
case -1657678854: // obligor
((CDSIndexComponentBean) bean).setObligor((ExternalIdBean) newValue);
return;
case -791592328: // weight
((CDSIndexComponentBean) bean).setWeight((Double) newValue);
return;
case -1383424194: // bondId
((CDSIndexComponentBean) bean).setBondId((ExternalIdBean) newValue);
return;
case 3373707: // name
((CDSIndexComponentBean) bean).setName((String) newValue);
return;
}
super.propertySet(bean, propertyName, newValue, quiet);
}
}
///CLOVER:ON
//-------------------------- AUTOGENERATED END --------------------------
}