/** * 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.DirectMetaProperty; import org.joda.beans.impl.direct.DirectMetaPropertyMap; import com.opengamma.masterdb.security.hibernate.ExternalIdBean; import com.opengamma.masterdb.security.hibernate.SecurityBean; /** * A Hibernate bean representation of {@link IndexBean}. */ @BeanDefinition public abstract class IndexBean extends SecurityBean { @PropertyDefinition private String _description; /** * The index family id. */ @PropertyDefinition private ExternalIdBean _indexFamilyId; @Override public boolean equals(final Object other) { if (!(other instanceof IndexBean)) { return false; } IndexBean index = (IndexBean) other; return new EqualsBuilder() .append(getId(), index.getId()) .append(getDescription(), index.getDescription()) .append(getIndexFamilyId(), index.getIndexFamilyId()) .isEquals(); } @Override public int hashCode() { return new HashCodeBuilder() .append(getDescription()) .toHashCode(); } //------------------------- AUTOGENERATED START ------------------------- ///CLOVER:OFF /** * The meta-bean for {@code IndexBean}. * @return the meta-bean, not null */ public static IndexBean.Meta meta() { return IndexBean.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(IndexBean.Meta.INSTANCE); } @Override public IndexBean.Meta metaBean() { return IndexBean.Meta.INSTANCE; } //----------------------------------------------------------------------- /** * Gets the description. * @return the value of the property */ public String getDescription() { return _description; } /** * Sets the description. * @param description the new value of the property */ public void setDescription(String description) { this._description = description; } /** * Gets the the {@code description} property. * @return the property, not null */ public final Property<String> description() { return metaBean().description().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the index family id. * @return the value of the property */ public ExternalIdBean getIndexFamilyId() { return _indexFamilyId; } /** * Sets the index family id. * @param indexFamilyId the new value of the property */ public void setIndexFamilyId(ExternalIdBean indexFamilyId) { this._indexFamilyId = indexFamilyId; } /** * Gets the the {@code indexFamilyId} property. * @return the property, not null */ public final Property<ExternalIdBean> indexFamilyId() { return metaBean().indexFamilyId().createProperty(this); } //----------------------------------------------------------------------- @Override public String toString() { StringBuilder buf = new StringBuilder(96); buf.append("IndexBean{"); 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("description").append('=').append(JodaBeanUtils.toString(getDescription())).append(',').append(' '); buf.append("indexFamilyId").append('=').append(JodaBeanUtils.toString(getIndexFamilyId())).append(',').append(' '); } //----------------------------------------------------------------------- /** * The meta-bean for {@code IndexBean}. */ public static class Meta extends SecurityBean.Meta { /** * The singleton instance of the meta-bean. */ static final Meta INSTANCE = new Meta(); /** * The meta-property for the {@code description} property. */ private final MetaProperty<String> _description = DirectMetaProperty.ofReadWrite( this, "description", IndexBean.class, String.class); /** * The meta-property for the {@code indexFamilyId} property. */ private final MetaProperty<ExternalIdBean> _indexFamilyId = DirectMetaProperty.ofReadWrite( this, "indexFamilyId", IndexBean.class, ExternalIdBean.class); /** * The meta-properties. */ private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap( this, (DirectMetaPropertyMap) super.metaPropertyMap(), "description", "indexFamilyId"); /** * Restricted constructor. */ protected Meta() { } @Override protected MetaProperty<?> metaPropertyGet(String propertyName) { switch (propertyName.hashCode()) { case -1724546052: // description return _description; case 1598011025: // indexFamilyId return _indexFamilyId; } return super.metaPropertyGet(propertyName); } @Override public BeanBuilder<? extends IndexBean> builder() { throw new UnsupportedOperationException("IndexBean is an abstract class"); } @Override public Class<? extends IndexBean> beanType() { return IndexBean.class; } @Override public Map<String, MetaProperty<?>> metaPropertyMap() { return _metaPropertyMap$; } //----------------------------------------------------------------------- /** * The meta-property for the {@code description} property. * @return the meta-property, not null */ public final MetaProperty<String> description() { return _description; } /** * The meta-property for the {@code indexFamilyId} property. * @return the meta-property, not null */ public final MetaProperty<ExternalIdBean> indexFamilyId() { return _indexFamilyId; } //----------------------------------------------------------------------- @Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case -1724546052: // description return ((IndexBean) bean).getDescription(); case 1598011025: // indexFamilyId return ((IndexBean) bean).getIndexFamilyId(); } return super.propertyGet(bean, propertyName, quiet); } @Override protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) { switch (propertyName.hashCode()) { case -1724546052: // description ((IndexBean) bean).setDescription((String) newValue); return; case 1598011025: // indexFamilyId ((IndexBean) bean).setIndexFamilyId((ExternalIdBean) newValue); return; } super.propertySet(bean, propertyName, newValue, quiet); } } ///CLOVER:ON //-------------------------- AUTOGENERATED END -------------------------- }