/**
* Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.masterdb.security.hibernate.index;
import java.util.List;
import java.util.Map;
import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
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.masterdb.security.hibernate.IndexWeightingTypeBean;
/**
* A Hibernate bean representation of {@link BondIndexBean}.
*/
@BeanDefinition
public class BondIndexBean extends IndexBean {
@PropertyDefinition
private List<BondIndexComponentBean> _bondComponents;
@PropertyDefinition
private IndexWeightingTypeBean _weightingType;
@Override
public boolean equals(final Object other) {
if (!(other instanceof BondIndexBean)) {
return false;
}
BondIndexBean index = (BondIndexBean) other;
return new EqualsBuilder()
.append(getId(), index.getId())
.append(getDescription(), index.getDescription())
.append(getBondComponents(), index.getBondComponents())
.append(getWeightingType(), index.getWeightingType())
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder()
.append(getDescription())
.append(getBondComponents())
.append(getWeightingType())
.toHashCode();
}
//------------------------- AUTOGENERATED START -------------------------
///CLOVER:OFF
/**
* The meta-bean for {@code BondIndexBean}.
* @return the meta-bean, not null
*/
public static BondIndexBean.Meta meta() {
return BondIndexBean.Meta.INSTANCE;
}
static {
JodaBeanUtils.registerMetaBean(BondIndexBean.Meta.INSTANCE);
}
@Override
public BondIndexBean.Meta metaBean() {
return BondIndexBean.Meta.INSTANCE;
}
//-----------------------------------------------------------------------
/**
* Gets the bondComponents.
* @return the value of the property
*/
public List<BondIndexComponentBean> getBondComponents() {
return _bondComponents;
}
/**
* Sets the bondComponents.
* @param bondComponents the new value of the property
*/
public void setBondComponents(List<BondIndexComponentBean> bondComponents) {
this._bondComponents = bondComponents;
}
/**
* Gets the the {@code bondComponents} property.
* @return the property, not null
*/
public final Property<List<BondIndexComponentBean>> bondComponents() {
return metaBean().bondComponents().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the weightingType.
* @return the value of the property
*/
public IndexWeightingTypeBean getWeightingType() {
return _weightingType;
}
/**
* Sets the weightingType.
* @param weightingType the new value of the property
*/
public void setWeightingType(IndexWeightingTypeBean weightingType) {
this._weightingType = weightingType;
}
/**
* Gets the the {@code weightingType} property.
* @return the property, not null
*/
public final Property<IndexWeightingTypeBean> weightingType() {
return metaBean().weightingType().createProperty(this);
}
//-----------------------------------------------------------------------
@Override
public BondIndexBean clone() {
return JodaBeanUtils.cloneAlways(this);
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(96);
buf.append("BondIndexBean{");
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("bondComponents").append('=').append(JodaBeanUtils.toString(getBondComponents())).append(',').append(' ');
buf.append("weightingType").append('=').append(JodaBeanUtils.toString(getWeightingType())).append(',').append(' ');
}
//-----------------------------------------------------------------------
/**
* The meta-bean for {@code BondIndexBean}.
*/
public static class Meta extends IndexBean.Meta {
/**
* The singleton instance of the meta-bean.
*/
static final Meta INSTANCE = new Meta();
/**
* The meta-property for the {@code bondComponents} property.
*/
@SuppressWarnings({"unchecked", "rawtypes" })
private final MetaProperty<List<BondIndexComponentBean>> _bondComponents = DirectMetaProperty.ofReadWrite(
this, "bondComponents", BondIndexBean.class, (Class) List.class);
/**
* The meta-property for the {@code weightingType} property.
*/
private final MetaProperty<IndexWeightingTypeBean> _weightingType = DirectMetaProperty.ofReadWrite(
this, "weightingType", BondIndexBean.class, IndexWeightingTypeBean.class);
/**
* The meta-properties.
*/
private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap(
this, (DirectMetaPropertyMap) super.metaPropertyMap(),
"bondComponents",
"weightingType");
/**
* Restricted constructor.
*/
protected Meta() {
}
@Override
protected MetaProperty<?> metaPropertyGet(String propertyName) {
switch (propertyName.hashCode()) {
case -1249361351: // bondComponents
return _bondComponents;
case 86270148: // weightingType
return _weightingType;
}
return super.metaPropertyGet(propertyName);
}
@Override
public BeanBuilder<? extends BondIndexBean> builder() {
return new DirectBeanBuilder<BondIndexBean>(new BondIndexBean());
}
@Override
public Class<? extends BondIndexBean> beanType() {
return BondIndexBean.class;
}
@Override
public Map<String, MetaProperty<?>> metaPropertyMap() {
return _metaPropertyMap$;
}
//-----------------------------------------------------------------------
/**
* The meta-property for the {@code bondComponents} property.
* @return the meta-property, not null
*/
public final MetaProperty<List<BondIndexComponentBean>> bondComponents() {
return _bondComponents;
}
/**
* The meta-property for the {@code weightingType} property.
* @return the meta-property, not null
*/
public final MetaProperty<IndexWeightingTypeBean> weightingType() {
return _weightingType;
}
//-----------------------------------------------------------------------
@Override
protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {
switch (propertyName.hashCode()) {
case -1249361351: // bondComponents
return ((BondIndexBean) bean).getBondComponents();
case 86270148: // weightingType
return ((BondIndexBean) bean).getWeightingType();
}
return super.propertyGet(bean, propertyName, quiet);
}
@SuppressWarnings("unchecked")
@Override
protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {
switch (propertyName.hashCode()) {
case -1249361351: // bondComponents
((BondIndexBean) bean).setBondComponents((List<BondIndexComponentBean>) newValue);
return;
case 86270148: // weightingType
((BondIndexBean) bean).setWeightingType((IndexWeightingTypeBean) newValue);
return;
}
super.propertySet(bean, propertyName, newValue, quiet);
}
}
///CLOVER:ON
//-------------------------- AUTOGENERATED END --------------------------
}