/**
* 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.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.ExternalIdBean;
import com.opengamma.masterdb.security.hibernate.TenorBean;
/**
* A Hibernate bean representation of {@link IborIndexBean}.
*/
@BeanDefinition
public class IborIndexBean extends IndexBean {
@PropertyDefinition
private TenorBean _tenor;
@PropertyDefinition
private ExternalIdBean _conventionId;
@Override
public boolean equals(final Object other) {
if (!(other instanceof IborIndexBean)) {
return false;
}
IborIndexBean index = (IborIndexBean) other;
return new EqualsBuilder()
.append(getId(), index.getId())
.append(getDescription(), index.getDescription())
.append(getTenor(), index.getTenor())
.append(getConventionId(), index.getConventionId())
.isEquals();
}
@Override
public int hashCode() {
return new HashCodeBuilder()
.append(getDescription())
.append(getTenor())
.append(getConventionId())
.toHashCode();
}
//------------------------- AUTOGENERATED START -------------------------
///CLOVER:OFF
/**
* The meta-bean for {@code IborIndexBean}.
* @return the meta-bean, not null
*/
public static IborIndexBean.Meta meta() {
return IborIndexBean.Meta.INSTANCE;
}
static {
JodaBeanUtils.registerMetaBean(IborIndexBean.Meta.INSTANCE);
}
@Override
public IborIndexBean.Meta metaBean() {
return IborIndexBean.Meta.INSTANCE;
}
//-----------------------------------------------------------------------
/**
* Gets the tenor.
* @return the value of the property
*/
public TenorBean getTenor() {
return _tenor;
}
/**
* Sets the tenor.
* @param tenor the new value of the property
*/
public void setTenor(TenorBean tenor) {
this._tenor = tenor;
}
/**
* Gets the the {@code tenor} property.
* @return the property, not null
*/
public final Property<TenorBean> tenor() {
return metaBean().tenor().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the conventionId.
* @return the value of the property
*/
public ExternalIdBean getConventionId() {
return _conventionId;
}
/**
* Sets the conventionId.
* @param conventionId the new value of the property
*/
public void setConventionId(ExternalIdBean conventionId) {
this._conventionId = conventionId;
}
/**
* Gets the the {@code conventionId} property.
* @return the property, not null
*/
public final Property<ExternalIdBean> conventionId() {
return metaBean().conventionId().createProperty(this);
}
//-----------------------------------------------------------------------
@Override
public IborIndexBean clone() {
return JodaBeanUtils.cloneAlways(this);
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(96);
buf.append("IborIndexBean{");
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("tenor").append('=').append(JodaBeanUtils.toString(getTenor())).append(',').append(' ');
buf.append("conventionId").append('=').append(JodaBeanUtils.toString(getConventionId())).append(',').append(' ');
}
//-----------------------------------------------------------------------
/**
* The meta-bean for {@code IborIndexBean}.
*/
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 tenor} property.
*/
private final MetaProperty<TenorBean> _tenor = DirectMetaProperty.ofReadWrite(
this, "tenor", IborIndexBean.class, TenorBean.class);
/**
* The meta-property for the {@code conventionId} property.
*/
private final MetaProperty<ExternalIdBean> _conventionId = DirectMetaProperty.ofReadWrite(
this, "conventionId", IborIndexBean.class, ExternalIdBean.class);
/**
* The meta-properties.
*/
private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap(
this, (DirectMetaPropertyMap) super.metaPropertyMap(),
"tenor",
"conventionId");
/**
* Restricted constructor.
*/
protected Meta() {
}
@Override
protected MetaProperty<?> metaPropertyGet(String propertyName) {
switch (propertyName.hashCode()) {
case 110246592: // tenor
return _tenor;
case 1520979052: // conventionId
return _conventionId;
}
return super.metaPropertyGet(propertyName);
}
@Override
public BeanBuilder<? extends IborIndexBean> builder() {
return new DirectBeanBuilder<IborIndexBean>(new IborIndexBean());
}
@Override
public Class<? extends IborIndexBean> beanType() {
return IborIndexBean.class;
}
@Override
public Map<String, MetaProperty<?>> metaPropertyMap() {
return _metaPropertyMap$;
}
//-----------------------------------------------------------------------
/**
* The meta-property for the {@code tenor} property.
* @return the meta-property, not null
*/
public final MetaProperty<TenorBean> tenor() {
return _tenor;
}
/**
* The meta-property for the {@code conventionId} property.
* @return the meta-property, not null
*/
public final MetaProperty<ExternalIdBean> conventionId() {
return _conventionId;
}
//-----------------------------------------------------------------------
@Override
protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {
switch (propertyName.hashCode()) {
case 110246592: // tenor
return ((IborIndexBean) bean).getTenor();
case 1520979052: // conventionId
return ((IborIndexBean) bean).getConventionId();
}
return super.propertyGet(bean, propertyName, quiet);
}
@Override
protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {
switch (propertyName.hashCode()) {
case 110246592: // tenor
((IborIndexBean) bean).setTenor((TenorBean) newValue);
return;
case 1520979052: // conventionId
((IborIndexBean) bean).setConventionId((ExternalIdBean) newValue);
return;
}
super.propertySet(bean, propertyName, newValue, quiet);
}
}
///CLOVER:ON
//-------------------------- AUTOGENERATED END --------------------------
}