Package com.opengamma.strata.data
Class ImmutableMarketDataBuilder
- java.lang.Object
-
- com.opengamma.strata.data.ImmutableMarketDataBuilder
-
public class ImmutableMarketDataBuilder extends Object
A mutable builder for instances ofImmutableMarketData.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImmutableMarketDataBuilderadd(MarketData other)Adds all time series and values from another market data instance.ImmutableMarketDataBuilderaddTimeSeries(ObservableId id, LocalDateDoubleTimeSeries timeSeries)Adds a time-series of observable market data values.ImmutableMarketDataBuilderaddTimeSeriesMap(Map<? extends ObservableId,LocalDateDoubleTimeSeries> timeSeriesMap)Adds multiple time-series of observable market data values to the builder.<T> ImmutableMarketDataBuilderaddValue(MarketDataId<T> id, T value)Adds a value to the builder.ImmutableMarketDataBuilderaddValueMap(Map<? extends MarketDataId<?>,?> values)Adds multiple values to the builder.<T> ImmutableMarketDataBuilderaddValueUnsafe(MarketDataId<?> id, Object value)Adds a value to the builder when the types are not known at compile time.ImmutableMarketDatabuild()Returns a set of market data built from the data in this builder.ImmutableMarketDataBuilderremoveTimeSeriesIf(Predicate<ObservableId> predicate)Removes values where the time series ID matches the specified predicate.ImmutableMarketDataBuilderremoveValueIf(Predicate<MarketDataId<?>> predicate)Removes values where the value ID matches the specified predicate.ImmutableMarketDataBuildertimeSeries(Map<? extends ObservableId,LocalDateDoubleTimeSeries> timeSeries)Sets the time-series in the builder, replacing any existing values.ImmutableMarketDataBuildervaluationDate(LocalDate valuationDate)Sets the valuation date.ImmutableMarketDataBuildervalues(Map<? extends MarketDataId<?>,?> values)Sets the values in the builder, replacing any existing values.
-
-
-
Method Detail
-
valuationDate
public ImmutableMarketDataBuilder valuationDate(LocalDate valuationDate)
Sets the valuation date.- Parameters:
valuationDate- the valuation date to set- Returns:
- this builder
-
values
public ImmutableMarketDataBuilder values(Map<? extends MarketDataId<?>,?> values)
Sets the values in the builder, replacing any existing values.- Parameters:
values- the values- Returns:
- this builder
-
timeSeries
public ImmutableMarketDataBuilder timeSeries(Map<? extends ObservableId,LocalDateDoubleTimeSeries> timeSeries)
Sets the time-series in the builder, replacing any existing values.- Parameters:
timeSeries- the time-series- Returns:
- this builder
-
addValue
public <T> ImmutableMarketDataBuilder addValue(MarketDataId<T> id, T value)
Adds a value to the builder.- Type Parameters:
T- the type of the market data value- Parameters:
id- the identifiervalue- the market data value- Returns:
- this builder
-
addValueUnsafe
public <T> ImmutableMarketDataBuilder addValueUnsafe(MarketDataId<?> id, Object value)
Adds a value to the builder when the types are not known at compile time.- Type Parameters:
T- the type of the market data value- Parameters:
id- the identifiervalue- the market data value- Returns:
- this builder
-
addValueMap
public ImmutableMarketDataBuilder addValueMap(Map<? extends MarketDataId<?>,?> values)
Adds multiple values to the builder.- Parameters:
values- the values- Returns:
- this builder
-
addTimeSeries
public ImmutableMarketDataBuilder addTimeSeries(ObservableId id, LocalDateDoubleTimeSeries timeSeries)
Adds a time-series of observable market data values.Any existing time-series with the same identifier will be replaced.
- Parameters:
id- the identifiertimeSeries- a time-series of observable market data values- Returns:
- this builder
-
addTimeSeriesMap
public ImmutableMarketDataBuilder addTimeSeriesMap(Map<? extends ObservableId,LocalDateDoubleTimeSeries> timeSeriesMap)
Adds multiple time-series of observable market data values to the builder.Any existing time-series with the same identifier will be replaced.
- Parameters:
timeSeriesMap- the map of time-series- Returns:
- this builder
-
add
public ImmutableMarketDataBuilder add(MarketData other)
Adds all time series and values from another market data instance.The valuation date of the other market data instance is ignored.
- Parameters:
other- the other market data instance- Returns:
- this builder
-
removeTimeSeriesIf
public ImmutableMarketDataBuilder removeTimeSeriesIf(Predicate<ObservableId> predicate)
Removes values where the time series ID matches the specified predicate.- Parameters:
predicate- the predicate to apply, item removed if the predicate returns true- Returns:
- this builder
-
removeValueIf
public ImmutableMarketDataBuilder removeValueIf(Predicate<MarketDataId<?>> predicate)
Removes values where the value ID matches the specified predicate.- Parameters:
predicate- the predicate to apply, item removed if the predicate returns true- Returns:
- this builder
-
build
public ImmutableMarketData build()
Returns a set of market data built from the data in this builder.- Returns:
- a set of market data built from the data in this builder
-
-