/** * Copyright (C) 2013 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.opengamma.financial.analytics.ircurve.strips; 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; import com.opengamma.util.ArgumentChecker; import com.opengamma.util.time.Tenor; /** * */ @BeanDefinition public class FRANode extends CurveNode { /** Serialization version */ private static final long serialVersionUID = 1L; /** * The fixing start tenor. */ @PropertyDefinition(validate = "notNull") private Tenor _fixingStart; /** * The fixing end tenor. */ @PropertyDefinition(validate = "notNull") private Tenor _fixingEnd; /** * The convention. */ @PropertyDefinition(validate = "notNull") private ExternalId _convention; /** * For the builder. */ /* package */FRANode() { super(); } /** * @param fixingStart The fixing start tenor, not null * @param fixingEnd The fixing end tenor, not null * @param convention The convention of the underlying rate, not null * @param curveNodeIdMapperName The name of the curve node id mapper, not null */ public FRANode(final Tenor fixingStart, final Tenor fixingEnd, final ExternalId convention, final String curveNodeIdMapperName) { super(curveNodeIdMapperName); setFixingStart(fixingStart); setFixingEnd(fixingEnd); setConvention(convention); } /** * @param fixingStart The fixing start tenor, not null * @param fixingEnd The fixing end tenor, not null * @param convention The convention of the underlying rate, not null * @param curveNodeIdMapperName The name of the curve node id mapper, not null * @param name The name */ public FRANode(final Tenor fixingStart, final Tenor fixingEnd, final ExternalId convention, final String curveNodeIdMapperName, final String name) { super(curveNodeIdMapperName, name); setFixingStart(fixingStart); setFixingEnd(fixingEnd); setConvention(convention); } @Override public Tenor getResolvedMaturity() { return _fixingEnd; } @Override public <T> T accept(final CurveNodeVisitor<T> visitor) { ArgumentChecker.notNull(visitor, "visitor"); return visitor.visitFRANode(this); } //------------------------- AUTOGENERATED START ------------------------- ///CLOVER:OFF /** * The meta-bean for {@code FRANode}. * @return the meta-bean, not null */ public static FRANode.Meta meta() { return FRANode.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(FRANode.Meta.INSTANCE); } @Override public FRANode.Meta metaBean() { return FRANode.Meta.INSTANCE; } //----------------------------------------------------------------------- /** * Gets the fixing start tenor. * @return the value of the property, not null */ public Tenor getFixingStart() { return _fixingStart; } /** * Sets the fixing start tenor. * @param fixingStart the new value of the property, not null */ public void setFixingStart(Tenor fixingStart) { JodaBeanUtils.notNull(fixingStart, "fixingStart"); this._fixingStart = fixingStart; } /** * Gets the the {@code fixingStart} property. * @return the property, not null */ public final Property<Tenor> fixingStart() { return metaBean().fixingStart().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the fixing end tenor. * @return the value of the property, not null */ public Tenor getFixingEnd() { return _fixingEnd; } /** * Sets the fixing end tenor. * @param fixingEnd the new value of the property, not null */ public void setFixingEnd(Tenor fixingEnd) { JodaBeanUtils.notNull(fixingEnd, "fixingEnd"); this._fixingEnd = fixingEnd; } /** * Gets the the {@code fixingEnd} property. * @return the property, not null */ public final Property<Tenor> fixingEnd() { return metaBean().fixingEnd().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the convention. * @return the value of the property, not null */ public ExternalId getConvention() { return _convention; } /** * Sets the convention. * @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 FRANode clone() { return JodaBeanUtils.cloneAlways(this); } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj != null && obj.getClass() == this.getClass()) { FRANode other = (FRANode) obj; return JodaBeanUtils.equal(getFixingStart(), other.getFixingStart()) && JodaBeanUtils.equal(getFixingEnd(), other.getFixingEnd()) && JodaBeanUtils.equal(getConvention(), other.getConvention()) && super.equals(obj); } return false; } @Override public int hashCode() { int hash = 7; hash = hash * 31 + JodaBeanUtils.hashCode(getFixingStart()); hash = hash * 31 + JodaBeanUtils.hashCode(getFixingEnd()); hash = hash * 31 + JodaBeanUtils.hashCode(getConvention()); return hash ^ super.hashCode(); } @Override public String toString() { StringBuilder buf = new StringBuilder(128); buf.append("FRANode{"); 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("fixingStart").append('=').append(JodaBeanUtils.toString(getFixingStart())).append(',').append(' '); buf.append("fixingEnd").append('=').append(JodaBeanUtils.toString(getFixingEnd())).append(',').append(' '); buf.append("convention").append('=').append(JodaBeanUtils.toString(getConvention())).append(',').append(' '); } //----------------------------------------------------------------------- /** * The meta-bean for {@code FRANode}. */ public static class Meta extends CurveNode.Meta { /** * The singleton instance of the meta-bean. */ static final Meta INSTANCE = new Meta(); /** * The meta-property for the {@code fixingStart} property. */ private final MetaProperty<Tenor> _fixingStart = DirectMetaProperty.ofReadWrite( this, "fixingStart", FRANode.class, Tenor.class); /** * The meta-property for the {@code fixingEnd} property. */ private final MetaProperty<Tenor> _fixingEnd = DirectMetaProperty.ofReadWrite( this, "fixingEnd", FRANode.class, Tenor.class); /** * The meta-property for the {@code convention} property. */ private final MetaProperty<ExternalId> _convention = DirectMetaProperty.ofReadWrite( this, "convention", FRANode.class, ExternalId.class); /** * The meta-properties. */ private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap( this, (DirectMetaPropertyMap) super.metaPropertyMap(), "fixingStart", "fixingEnd", "convention"); /** * Restricted constructor. */ protected Meta() { } @Override protected MetaProperty<?> metaPropertyGet(String propertyName) { switch (propertyName.hashCode()) { case 270958773: // fixingStart return _fixingStart; case 871775726: // fixingEnd return _fixingEnd; case 2039569265: // convention return _convention; } return super.metaPropertyGet(propertyName); } @Override public BeanBuilder<? extends FRANode> builder() { return new DirectBeanBuilder<FRANode>(new FRANode()); } @Override public Class<? extends FRANode> beanType() { return FRANode.class; } @Override public Map<String, MetaProperty<?>> metaPropertyMap() { return _metaPropertyMap$; } //----------------------------------------------------------------------- /** * The meta-property for the {@code fixingStart} property. * @return the meta-property, not null */ public final MetaProperty<Tenor> fixingStart() { return _fixingStart; } /** * The meta-property for the {@code fixingEnd} property. * @return the meta-property, not null */ public final MetaProperty<Tenor> fixingEnd() { return _fixingEnd; } /** * 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 270958773: // fixingStart return ((FRANode) bean).getFixingStart(); case 871775726: // fixingEnd return ((FRANode) bean).getFixingEnd(); case 2039569265: // convention return ((FRANode) bean).getConvention(); } return super.propertyGet(bean, propertyName, quiet); } @Override protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) { switch (propertyName.hashCode()) { case 270958773: // fixingStart ((FRANode) bean).setFixingStart((Tenor) newValue); return; case 871775726: // fixingEnd ((FRANode) bean).setFixingEnd((Tenor) newValue); return; case 2039569265: // convention ((FRANode) bean).setConvention((ExternalId) newValue); return; } super.propertySet(bean, propertyName, newValue, quiet); } @Override protected void validate(Bean bean) { JodaBeanUtils.notNull(((FRANode) bean)._fixingStart, "fixingStart"); JodaBeanUtils.notNull(((FRANode) bean)._fixingEnd, "fixingEnd"); JodaBeanUtils.notNull(((FRANode) bean)._convention, "convention"); super.validate(bean); } } ///CLOVER:ON //-------------------------- AUTOGENERATED END -------------------------- }