@ImmutableValidator private void validate() { if (!index.getCurrencyPair().equals(fxForwardRates.getCurrencyPair())) { throw new IllegalArgumentException("Underlying FxForwardRates must have same currency pair"); } }
public void test_equals_hashCode() { CurrencyPair a1 = CurrencyPair.of(AUD, GBP); CurrencyPair a2 = CurrencyPair.of(AUD, GBP); CurrencyPair b = CurrencyPair.of(USD, GBP); CurrencyPair c = CurrencyPair.of(USD, EUR); assertEquals(a1.equals(a1), true); assertEquals(a1.equals(a2), true); assertEquals(a1.equals(b), false); assertEquals(a1.equals(c), false); assertEquals(b.equals(a1), false); assertEquals(b.equals(a2), false); assertEquals(b.equals(b), true); assertEquals(b.equals(c), false); assertEquals(c.equals(a1), false); assertEquals(c.equals(a2), false); assertEquals(c.equals(b), false); assertEquals(c.equals(c), true); assertEquals(a1.hashCode(), a2.hashCode()); }
@ImmutableValidator private void validate() { CurrencyPair pair = index.getCurrencyPair(); if (!pair.contains(settlementCurrencyNotional.getCurrency())) { throw new IllegalArgumentException("FxIndex and settlement notional currency are incompatible"); } if (!(pair.equals(agreedFxRate.getPair()) || pair.isInverse(agreedFxRate.getPair()))) { throw new IllegalArgumentException("FxIndex and agreed FX rate are incompatible"); } }
@ImmutableValidator private void validate() { CurrencyPair pair = observation.getIndex().getCurrencyPair(); if (!pair.contains(settlementCurrencyNotional.getCurrency())) { throw new IllegalArgumentException("FxIndex and settlement notional currency are incompatible"); } if (!(pair.equals(agreedFxRate.getPair()) || pair.isInverse(agreedFxRate.getPair()))) { throw new IllegalArgumentException("FxIndex and agreed FX rate are incompatible"); } }
"FxRate '{}' and CurrencyAmount '{}' must have a currency in common", nearRate, amount)); if (!nearRate.getPair().toConventional().equals(farRate.getPair().toConventional())) { throw new IllegalArgumentException(Messages.format( "FxRate '{}' and FxRate '{}' must contain the same currencies", nearRate, farRate));
"FxRate '{}' and CurrencyAmount '{}' must have a currency in common", nearRate, amount)); if (!nearRate.getPair().toConventional().equals(farRate.getPair().toConventional())) { throw new IllegalArgumentException(Messages.format( "FxRate '{}' and FxRate '{}' must contain the same currencies", nearRate, farRate));
@ImmutablePreBuild private static void preBuild(Builder builder) { if (builder.template != null) { if (builder.label == null) { builder.label = builder.template.getTenor().toString(); } if (builder.fxRateId == null) { builder.fxRateId = FxRateId.of(builder.template.getCurrencyPair()); } else { ArgChecker.isTrue( builder.fxRateId.getPair().toConventional().equals(builder.template.getCurrencyPair().toConventional()), "FxRateId currency pair '{}' must match that of the template '{}'", builder.fxRateId.getPair(), builder.template.getCurrencyPair()); } } }
@ImmutablePreBuild private static void preBuild(Builder builder) { if (builder.template != null) { if (builder.label == null) { builder.label = Tenor.of(builder.template.getPeriodToFar()).toString(); } if (builder.fxRateId == null) { builder.fxRateId = FxRateId.of(builder.template.getCurrencyPair()); } else { ArgChecker.isTrue( builder.fxRateId.getPair().toConventional().equals(builder.template.getCurrencyPair().toConventional()), "FxRateId currency pair '{}' must match that of the template '{}'", builder.fxRateId.getPair(), builder.template.getCurrencyPair()); } } }