AllDiscountCurvesFilter implements MarketDataFilter, ImmutableBean { @Override public Set<MulticurveMatchDetails> apply(MarketDataId<?> marketDataId) { MulticurveId id = (MulticurveId) marketDataId; MulticurveMetadata metadata = MulticurveMetadata.forConfiguration(id.resolveConfig()); Set<MulticurveMatchDetails> filter = Sets.newHashSet(); Set<String> curves = metadata.getDiscountingCurveNames(); for (String curveName : curves) { filter.add(StandardMatchDetails.multicurve(curveName)); } return ImmutableSet.copyOf(filter); } @ImmutableConstructor  AllDiscountCurvesFilter(); @Override Set<MulticurveMatchDetails> apply(MarketDataId<?> marketDataId); @Override Set<MulticurveMatchDetails> apply(MarketDataId<?> marketDataId, Object marketData); @Override Class<?> getMarketDataType(); @Override Class<MulticurveId> getMarketDataIdType(); static AllDiscountCurvesFilter.Meta meta(); static AllDiscountCurvesFilter.Builder builder(); @Override AllDiscountCurvesFilter.Meta metaBean(); @Override Property<R> property(String propertyName); @Override Set<String> propertyNames(); @Override boolean equals(Object obj); @Override int hashCode(); @Override String toString();  }
@Test public void bundle() { AllDiscountCurvesFilter discountingFilter = new AllDiscountCurvesFilter(); Set<MulticurveMatchDetails> discountingMatches = discountingFilter.apply(MulticurveId.of("not used"), MulticurveFilterTestUtils.bundle()); Set<MulticurveMatchDetails> expectedDiscountingMatches = ImmutableSet.of( StandardMatchDetails.multicurve(MulticurveFilterTestUtils.USD_DISCOUNTING), StandardMatchDetails.multicurve(MulticurveFilterTestUtils.GBP_DISCOUNTING) ); assertEquals(expectedDiscountingMatches, discountingMatches); }
@Test public void config() { MulticurveFilterTestUtils.initializeServiceContext(); MulticurveId multicurveId = MulticurveId.of(MulticurveFilterTestUtils.CURVE_CONFIG_NAME); AllDiscountCurvesFilter discountingFilter = new AllDiscountCurvesFilter(); Set<MulticurveMatchDetails> discountingMatches = discountingFilter.apply(multicurveId); Set<MulticurveMatchDetails> expectedDiscountingMatches = ImmutableSet.of( StandardMatchDetails.multicurve(MulticurveFilterTestUtils.USD_DISCOUNTING), StandardMatchDetails.multicurve(MulticurveFilterTestUtils.GBP_DISCOUNTING) ); assertEquals(expectedDiscountingMatches, discountingMatches); }