/** * Copyright (C) 2013 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.opengamma.financial.analytics.curve; 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.id.ExternalId; /** * Configuration object for curves that are to be used as an overnight curve. */ @BeanDefinition public class OvernightCurveTypeConfiguration extends CurveTypeConfiguration { /** Serialization version */ private static final long serialVersionUID = 1L; /** * The convention of the index. */ @PropertyDefinition(validate = "notNull") private ExternalId _convention; /** * For the builder. */ /* package */ OvernightCurveTypeConfiguration() { super(); } /** * @param convention The id of the index convention, not null */ public OvernightCurveTypeConfiguration(final ExternalId convention) { super(); setConvention(convention); } //------------------------- AUTOGENERATED START ------------------------- ///CLOVER:OFF /** * The meta-bean for {@code OvernightCurveTypeConfiguration}. * @return the meta-bean, not null */ public static OvernightCurveTypeConfiguration.Meta meta() { return OvernightCurveTypeConfiguration.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(OvernightCurveTypeConfiguration.Meta.INSTANCE); } @Override public OvernightCurveTypeConfiguration.Meta metaBean() { return OvernightCurveTypeConfiguration.Meta.INSTANCE; } //----------------------------------------------------------------------- /** * Gets the convention of the index. * @return the value of the property, not null */ public ExternalId getConvention() { return _convention; } /** * Sets the convention of the index. * @param convention the new value of the property, not null */ public void setConvention(ExternalId convention) { JodaBeanUtils.notNull(convention, "convention"); this._convention = convention; } /** * Gets the the {@code convention} property. * @return the property, not null */ public final Property<ExternalId> convention() { return metaBean().convention().createProperty(this); } //----------------------------------------------------------------------- @Override public OvernightCurveTypeConfiguration clone() { return JodaBeanUtils.cloneAlways(this); } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj != null && obj.getClass() == this.getClass()) { OvernightCurveTypeConfiguration other = (OvernightCurveTypeConfiguration) obj; return JodaBeanUtils.equal(getConvention(), other.getConvention()) && super.equals(obj); } return false; } @Override public int hashCode() { int hash = 7; hash = hash * 31 + JodaBeanUtils.hashCode(getConvention()); return hash ^ super.hashCode(); } @Override public String toString() { StringBuilder buf = new StringBuilder(64); buf.append("OvernightCurveTypeConfiguration{"); 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("convention").append('=').append(JodaBeanUtils.toString(getConvention())).append(',').append(' '); } //----------------------------------------------------------------------- /** * The meta-bean for {@code OvernightCurveTypeConfiguration}. */ public static class Meta extends CurveTypeConfiguration.Meta { /** * The singleton instance of the meta-bean. */ static final Meta INSTANCE = new Meta(); /** * The meta-property for the {@code convention} property. */ private final MetaProperty<ExternalId> _convention = DirectMetaProperty.ofReadWrite( this, "convention", OvernightCurveTypeConfiguration.class, ExternalId.class); /** * The meta-properties. */ private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap( this, (DirectMetaPropertyMap) super.metaPropertyMap(), "convention"); /** * Restricted constructor. */ protected Meta() { } @Override protected MetaProperty<?> metaPropertyGet(String propertyName) { switch (propertyName.hashCode()) { case 2039569265: // convention return _convention; } return super.metaPropertyGet(propertyName); } @Override public BeanBuilder<? extends OvernightCurveTypeConfiguration> builder() { return new DirectBeanBuilder<OvernightCurveTypeConfiguration>(new OvernightCurveTypeConfiguration()); } @Override public Class<? extends OvernightCurveTypeConfiguration> beanType() { return OvernightCurveTypeConfiguration.class; } @Override public Map<String, MetaProperty<?>> metaPropertyMap() { return _metaPropertyMap$; } //----------------------------------------------------------------------- /** * The meta-property for the {@code convention} property. * @return the meta-property, not null */ public final MetaProperty<ExternalId> convention() { return _convention; } //----------------------------------------------------------------------- @Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 2039569265: // convention return ((OvernightCurveTypeConfiguration) bean).getConvention(); } return super.propertyGet(bean, propertyName, quiet); } @Override protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) { switch (propertyName.hashCode()) { case 2039569265: // convention ((OvernightCurveTypeConfiguration) bean).setConvention((ExternalId) newValue); return; } super.propertySet(bean, propertyName, newValue, quiet); } @Override protected void validate(Bean bean) { JodaBeanUtils.notNull(((OvernightCurveTypeConfiguration) bean)._convention, "convention"); super.validate(bean); } } ///CLOVER:ON //-------------------------- AUTOGENERATED END -------------------------- }