/** * Copyright (C) 2013 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.opengamma.integration.tool.portfolio.xml.v1_0.jaxb; import java.math.BigDecimal; import java.util.Map; import java.util.Set; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; 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.integration.tool.portfolio.xml.v1_0.conversion.FxForwardTradeSecurityExtractor; import com.opengamma.integration.tool.portfolio.xml.v1_0.conversion.TradeSecurityExtractor; import com.opengamma.util.money.Currency; @XmlRootElement @BeanDefinition public class FxForwardTrade extends Trade { @XmlElement(name = "payAmount", required = true) @PropertyDefinition private BigDecimal _payAmount; @XmlElement(name = "payCurrency", required = true) @PropertyDefinition private Currency _payCurrency; @XmlElement(name = "receiveAmount", required = true) @PropertyDefinition private BigDecimal _receiveAmount; @XmlElement(name = "receiveCurrency", required = true) @PropertyDefinition private Currency _receiveCurrency; @XmlElement(name = "settlementCurrency") @PropertyDefinition private Currency _settlementCurrency; @XmlElement(name = "fxExpiry") @PropertyDefinition private FxExpiry _fxExpiry; @XmlElementWrapper(name = "paymentCalendars") @XmlElement(name = "calendar") @PropertyDefinition private Set<Calendar> _paymentCalendars; @Override public boolean canBePositionAggregated() { return false; } @Override public TradeSecurityExtractor getSecurityExtractor() { return new FxForwardTradeSecurityExtractor(this); } //------------------------- AUTOGENERATED START ------------------------- ///CLOVER:OFF /** * The meta-bean for {@code FxForwardTrade}. * @return the meta-bean, not null */ public static FxForwardTrade.Meta meta() { return FxForwardTrade.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(FxForwardTrade.Meta.INSTANCE); } @Override public FxForwardTrade.Meta metaBean() { return FxForwardTrade.Meta.INSTANCE; } //----------------------------------------------------------------------- /** * Gets the payAmount. * @return the value of the property */ public BigDecimal getPayAmount() { return _payAmount; } /** * Sets the payAmount. * @param payAmount the new value of the property */ public void setPayAmount(BigDecimal payAmount) { this._payAmount = payAmount; } /** * Gets the the {@code payAmount} property. * @return the property, not null */ public final Property<BigDecimal> payAmount() { return metaBean().payAmount().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the payCurrency. * @return the value of the property */ public Currency getPayCurrency() { return _payCurrency; } /** * Sets the payCurrency. * @param payCurrency the new value of the property */ public void setPayCurrency(Currency payCurrency) { this._payCurrency = payCurrency; } /** * Gets the the {@code payCurrency} property. * @return the property, not null */ public final Property<Currency> payCurrency() { return metaBean().payCurrency().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the receiveAmount. * @return the value of the property */ public BigDecimal getReceiveAmount() { return _receiveAmount; } /** * Sets the receiveAmount. * @param receiveAmount the new value of the property */ public void setReceiveAmount(BigDecimal receiveAmount) { this._receiveAmount = receiveAmount; } /** * Gets the the {@code receiveAmount} property. * @return the property, not null */ public final Property<BigDecimal> receiveAmount() { return metaBean().receiveAmount().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the receiveCurrency. * @return the value of the property */ public Currency getReceiveCurrency() { return _receiveCurrency; } /** * Sets the receiveCurrency. * @param receiveCurrency the new value of the property */ public void setReceiveCurrency(Currency receiveCurrency) { this._receiveCurrency = receiveCurrency; } /** * Gets the the {@code receiveCurrency} property. * @return the property, not null */ public final Property<Currency> receiveCurrency() { return metaBean().receiveCurrency().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the settlementCurrency. * @return the value of the property */ public Currency getSettlementCurrency() { return _settlementCurrency; } /** * Sets the settlementCurrency. * @param settlementCurrency the new value of the property */ public void setSettlementCurrency(Currency settlementCurrency) { this._settlementCurrency = settlementCurrency; } /** * Gets the the {@code settlementCurrency} property. * @return the property, not null */ public final Property<Currency> settlementCurrency() { return metaBean().settlementCurrency().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the fxExpiry. * @return the value of the property */ public FxExpiry getFxExpiry() { return _fxExpiry; } /** * Sets the fxExpiry. * @param fxExpiry the new value of the property */ public void setFxExpiry(FxExpiry fxExpiry) { this._fxExpiry = fxExpiry; } /** * Gets the the {@code fxExpiry} property. * @return the property, not null */ public final Property<FxExpiry> fxExpiry() { return metaBean().fxExpiry().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the paymentCalendars. * @return the value of the property */ public Set<Calendar> getPaymentCalendars() { return _paymentCalendars; } /** * Sets the paymentCalendars. * @param paymentCalendars the new value of the property */ public void setPaymentCalendars(Set<Calendar> paymentCalendars) { this._paymentCalendars = paymentCalendars; } /** * Gets the the {@code paymentCalendars} property. * @return the property, not null */ public final Property<Set<Calendar>> paymentCalendars() { return metaBean().paymentCalendars().createProperty(this); } //----------------------------------------------------------------------- @Override public FxForwardTrade clone() { return JodaBeanUtils.cloneAlways(this); } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj != null && obj.getClass() == this.getClass()) { FxForwardTrade other = (FxForwardTrade) obj; return JodaBeanUtils.equal(getPayAmount(), other.getPayAmount()) && JodaBeanUtils.equal(getPayCurrency(), other.getPayCurrency()) && JodaBeanUtils.equal(getReceiveAmount(), other.getReceiveAmount()) && JodaBeanUtils.equal(getReceiveCurrency(), other.getReceiveCurrency()) && JodaBeanUtils.equal(getSettlementCurrency(), other.getSettlementCurrency()) && JodaBeanUtils.equal(getFxExpiry(), other.getFxExpiry()) && JodaBeanUtils.equal(getPaymentCalendars(), other.getPaymentCalendars()) && super.equals(obj); } return false; } @Override public int hashCode() { int hash = 7; hash = hash * 31 + JodaBeanUtils.hashCode(getPayAmount()); hash = hash * 31 + JodaBeanUtils.hashCode(getPayCurrency()); hash = hash * 31 + JodaBeanUtils.hashCode(getReceiveAmount()); hash = hash * 31 + JodaBeanUtils.hashCode(getReceiveCurrency()); hash = hash * 31 + JodaBeanUtils.hashCode(getSettlementCurrency()); hash = hash * 31 + JodaBeanUtils.hashCode(getFxExpiry()); hash = hash * 31 + JodaBeanUtils.hashCode(getPaymentCalendars()); return hash ^ super.hashCode(); } @Override public String toString() { StringBuilder buf = new StringBuilder(256); buf.append("FxForwardTrade{"); 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("payAmount").append('=').append(JodaBeanUtils.toString(getPayAmount())).append(',').append(' '); buf.append("payCurrency").append('=').append(JodaBeanUtils.toString(getPayCurrency())).append(',').append(' '); buf.append("receiveAmount").append('=').append(JodaBeanUtils.toString(getReceiveAmount())).append(',').append(' '); buf.append("receiveCurrency").append('=').append(JodaBeanUtils.toString(getReceiveCurrency())).append(',').append(' '); buf.append("settlementCurrency").append('=').append(JodaBeanUtils.toString(getSettlementCurrency())).append(',').append(' '); buf.append("fxExpiry").append('=').append(JodaBeanUtils.toString(getFxExpiry())).append(',').append(' '); buf.append("paymentCalendars").append('=').append(JodaBeanUtils.toString(getPaymentCalendars())).append(',').append(' '); } //----------------------------------------------------------------------- /** * The meta-bean for {@code FxForwardTrade}. */ public static class Meta extends Trade.Meta { /** * The singleton instance of the meta-bean. */ static final Meta INSTANCE = new Meta(); /** * The meta-property for the {@code payAmount} property. */ private final MetaProperty<BigDecimal> _payAmount = DirectMetaProperty.ofReadWrite( this, "payAmount", FxForwardTrade.class, BigDecimal.class); /** * The meta-property for the {@code payCurrency} property. */ private final MetaProperty<Currency> _payCurrency = DirectMetaProperty.ofReadWrite( this, "payCurrency", FxForwardTrade.class, Currency.class); /** * The meta-property for the {@code receiveAmount} property. */ private final MetaProperty<BigDecimal> _receiveAmount = DirectMetaProperty.ofReadWrite( this, "receiveAmount", FxForwardTrade.class, BigDecimal.class); /** * The meta-property for the {@code receiveCurrency} property. */ private final MetaProperty<Currency> _receiveCurrency = DirectMetaProperty.ofReadWrite( this, "receiveCurrency", FxForwardTrade.class, Currency.class); /** * The meta-property for the {@code settlementCurrency} property. */ private final MetaProperty<Currency> _settlementCurrency = DirectMetaProperty.ofReadWrite( this, "settlementCurrency", FxForwardTrade.class, Currency.class); /** * The meta-property for the {@code fxExpiry} property. */ private final MetaProperty<FxExpiry> _fxExpiry = DirectMetaProperty.ofReadWrite( this, "fxExpiry", FxForwardTrade.class, FxExpiry.class); /** * The meta-property for the {@code paymentCalendars} property. */ @SuppressWarnings({"unchecked", "rawtypes" }) private final MetaProperty<Set<Calendar>> _paymentCalendars = DirectMetaProperty.ofReadWrite( this, "paymentCalendars", FxForwardTrade.class, (Class) Set.class); /** * The meta-properties. */ private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap( this, (DirectMetaPropertyMap) super.metaPropertyMap(), "payAmount", "payCurrency", "receiveAmount", "receiveCurrency", "settlementCurrency", "fxExpiry", "paymentCalendars"); /** * Restricted constructor. */ protected Meta() { } @Override protected MetaProperty<?> metaPropertyGet(String propertyName) { switch (propertyName.hashCode()) { case -1338781920: // payAmount return _payAmount; case -295641895: // payCurrency return _payCurrency; case 984267035: // receiveAmount return _receiveAmount; case -1228590060: // receiveCurrency return _receiveCurrency; case -1024875430: // settlementCurrency return _settlementCurrency; case -1406037851: // fxExpiry return _fxExpiry; case -299417201: // paymentCalendars return _paymentCalendars; } return super.metaPropertyGet(propertyName); } @Override public BeanBuilder<? extends FxForwardTrade> builder() { return new DirectBeanBuilder<FxForwardTrade>(new FxForwardTrade()); } @Override public Class<? extends FxForwardTrade> beanType() { return FxForwardTrade.class; } @Override public Map<String, MetaProperty<?>> metaPropertyMap() { return _metaPropertyMap$; } //----------------------------------------------------------------------- /** * The meta-property for the {@code payAmount} property. * @return the meta-property, not null */ public final MetaProperty<BigDecimal> payAmount() { return _payAmount; } /** * The meta-property for the {@code payCurrency} property. * @return the meta-property, not null */ public final MetaProperty<Currency> payCurrency() { return _payCurrency; } /** * The meta-property for the {@code receiveAmount} property. * @return the meta-property, not null */ public final MetaProperty<BigDecimal> receiveAmount() { return _receiveAmount; } /** * The meta-property for the {@code receiveCurrency} property. * @return the meta-property, not null */ public final MetaProperty<Currency> receiveCurrency() { return _receiveCurrency; } /** * The meta-property for the {@code settlementCurrency} property. * @return the meta-property, not null */ public final MetaProperty<Currency> settlementCurrency() { return _settlementCurrency; } /** * The meta-property for the {@code fxExpiry} property. * @return the meta-property, not null */ public final MetaProperty<FxExpiry> fxExpiry() { return _fxExpiry; } /** * The meta-property for the {@code paymentCalendars} property. * @return the meta-property, not null */ public final MetaProperty<Set<Calendar>> paymentCalendars() { return _paymentCalendars; } //----------------------------------------------------------------------- @Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case -1338781920: // payAmount return ((FxForwardTrade) bean).getPayAmount(); case -295641895: // payCurrency return ((FxForwardTrade) bean).getPayCurrency(); case 984267035: // receiveAmount return ((FxForwardTrade) bean).getReceiveAmount(); case -1228590060: // receiveCurrency return ((FxForwardTrade) bean).getReceiveCurrency(); case -1024875430: // settlementCurrency return ((FxForwardTrade) bean).getSettlementCurrency(); case -1406037851: // fxExpiry return ((FxForwardTrade) bean).getFxExpiry(); case -299417201: // paymentCalendars return ((FxForwardTrade) bean).getPaymentCalendars(); } return super.propertyGet(bean, propertyName, quiet); } @SuppressWarnings("unchecked") @Override protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) { switch (propertyName.hashCode()) { case -1338781920: // payAmount ((FxForwardTrade) bean).setPayAmount((BigDecimal) newValue); return; case -295641895: // payCurrency ((FxForwardTrade) bean).setPayCurrency((Currency) newValue); return; case 984267035: // receiveAmount ((FxForwardTrade) bean).setReceiveAmount((BigDecimal) newValue); return; case -1228590060: // receiveCurrency ((FxForwardTrade) bean).setReceiveCurrency((Currency) newValue); return; case -1024875430: // settlementCurrency ((FxForwardTrade) bean).setSettlementCurrency((Currency) newValue); return; case -1406037851: // fxExpiry ((FxForwardTrade) bean).setFxExpiry((FxExpiry) newValue); return; case -299417201: // paymentCalendars ((FxForwardTrade) bean).setPaymentCalendars((Set<Calendar>) newValue); return; } super.propertySet(bean, propertyName, newValue, quiet); } } ///CLOVER:ON //-------------------------- AUTOGENERATED END -------------------------- }