public interface ReferenceData
Reference data is looked up using implementations of ReferenceDataId.
The identifier is parameterized with the type of the reference data to be returned.
The standard implementation is ImmutableReferenceData.
| Modifier and Type | Method and Description |
|---|---|
default ReferenceData |
combinedWith(ReferenceData other)
Combines this reference data with another.
|
default boolean |
containsValue(ReferenceDataId<?> id)
Checks if this reference data contains a value for the specified identifier.
|
static ReferenceData |
empty()
Obtains an instance containing no reference data.
|
default <T> Optional<T> |
findValue(ReferenceDataId<T> id)
Finds the reference data value associated with the specified identifier.
|
default <T> T |
getValue(ReferenceDataId<T> id)
Gets the reference data value associated with the specified identifier.
|
static ReferenceData |
minimal()
Obtains the minimal set of reference data.
|
static ReferenceData |
of(Map<? extends ReferenceDataId<?>,?> values)
Obtains an instance from a map of reference data.
|
<T> T |
queryValueOrNull(ReferenceDataId<T> id)
Low-level method to query the reference data value associated with the specified identifier,
returning null if not found.
|
static ReferenceData |
standard()
Obtains an instance of standard reference data.
|
static ReferenceData of(Map<? extends ReferenceDataId<?>,?> values)
Each entry in the map is a single piece of reference data, keyed by the matching identifier.
For example, a HolidayCalendar can be looked up using a HolidayCalendarId.
The caller must ensure that the each entry in the map corresponds with the parameterized
type on the identifier.
The resulting ReferenceData instance will include the minimal
set of reference data that includes non-controversial identifiers that are essential for pricing.
To exclude the minimal set of identifiers, use ImmutableReferenceData.of(Map).
values - the reference data valuesClassCastException - if a value does not match the parameterized type associated with the identifierstatic ReferenceData standard()
Standard reference data is built into Strata and provides common holiday calendars and indices. In most cases, production usage of Strata will not rely on this source of reference data.
static ReferenceData minimal()
The standard reference data contains common holiday calendars
and indices, but may not be suitable for production use. The minimal reference data contains
just those identifiers that are needed by Strata, and that are non-controversial.
These are HolidayCalendars.NO_HOLIDAYS, HolidayCalendars.SAT_SUN,
HolidayCalendars.FRI_SAT and HolidayCalendars.THU_FRI.
static ReferenceData empty()
default boolean containsValue(ReferenceDataId<?> id)
id - the identifier to finddefault <T> T getValue(ReferenceDataId<T> id)
If this reference data instance contains the identifier, the value will be returned. Otherwise, an exception will be thrown.
T - the type of the reference data valueid - the identifier to findReferenceDataNotFoundException - if the identifier is not founddefault <T> Optional<T> findValue(ReferenceDataId<T> id)
If this reference data instance contains the identifier, the value will be returned. Otherwise, an empty optional will be returned.
T - the type of the reference data valueid - the identifier to find<T> T queryValueOrNull(ReferenceDataId<T> id)
This is a low-level method that obtains the reference data value, returning null instead of an error.
Applications should use getValue(ReferenceDataId) in preference to this method.
T - the type of the reference data valueid - the identifier to finddefault ReferenceData combinedWith(ReferenceData other)
The result combines both sets of reference data. Values are taken from this set of reference data if available, otherwise they are taken from the other set.
other - the other reference dataCopyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.