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 ImmutableMarketDataBuilder
add(MarketData other)
Adds all time series and values from another market data instance.ImmutableMarketDataBuilder
addTimeSeries(ObservableId id, LocalDateDoubleTimeSeries timeSeries)
Adds a time-series of observable market data values.ImmutableMarketDataBuilder
addTimeSeriesMap(Map<? extends ObservableId,LocalDateDoubleTimeSeries> timeSeriesMap)
Adds multiple time-series of observable market data values to the builder.<T> ImmutableMarketDataBuilder
addValue(MarketDataId<T> id, T value)
Adds a value to the builder.ImmutableMarketDataBuilder
addValueMap(Map<? extends MarketDataId<?>,?> values)
Adds multiple values to the builder.<T> ImmutableMarketDataBuilder
addValueUnsafe(MarketDataId<?> id, Object value)
Adds a value to the builder when the types are not known at compile time.ImmutableMarketData
build()
Returns a set of market data built from the data in this builder.ImmutableMarketDataBuilder
removeTimeSeriesIf(Predicate<ObservableId> predicate)
Removes values where the time series ID matches the specified predicate.ImmutableMarketDataBuilder
removeValueIf(Predicate<MarketDataId<?>> predicate)
Removes values where the value ID matches the specified predicate.ImmutableMarketDataBuilder
timeSeries(Map<? extends ObservableId,LocalDateDoubleTimeSeries> timeSeries)
Sets the time-series in the builder, replacing any existing values.ImmutableMarketDataBuilder
valuationDate(LocalDate valuationDate)
Sets the valuation date.ImmutableMarketDataBuilder
values(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
-
-