/** * Adds a value to the builder when the types are not known at compile time. * * @param id the identifier * @param value the market data value * @param <T> the type of the market data value * @return this builder */ public <T> ImmutableMarketDataBuilder addValueUnsafe(MarketDataId<?> id, Object value) { ArgChecker.notNull(id, "id"); ArgChecker.notNull(value, "value"); ImmutableMarketData.checkType(id, value); values.put(id, value); return this; }
/** * Obtains an instance from a valuation date and map of values. * <p> * Use the {@linkplain #builder(LocalDate) builder} for more more complex use cases, * including setting time-series. * * @param valuationDate the valuation date associated with the market data * @param values the market data values * @return a set of market data containing the values in the map * @throws ClassCastException if a value does not match the parameterized type associated with the identifier */ public static ImmutableMarketData of(LocalDate valuationDate, Map<? extends MarketDataId<?>, ?> values) { MapStream.of(values).forEach((id, value) -> checkType(id, value)); return new ImmutableMarketData(valuationDate, values, ImmutableMap.of()); }