Class ImmutableReferenceData
- java.lang.Object
-
- com.opengamma.strata.basics.ImmutableReferenceData
-
- All Implemented Interfaces:
ReferenceData
,Serializable
,org.joda.beans.Bean
,org.joda.beans.ImmutableBean
public final class ImmutableReferenceData extends Object implements ReferenceData, org.joda.beans.ImmutableBean, Serializable
An immutable set of reference dataThis is the standard immutable implementation of
ReferenceData
.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ImmutableReferenceData.Meta
The meta-bean forImmutableReferenceData
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description ReferenceData
combinedWith(ReferenceData other)
Combines this reference data with another.static ImmutableReferenceData
empty()
Obtains an instance containing no reference data.boolean
equals(Object obj)
ImmutableMap<ReferenceDataId<?>,Object>
getValues()
Gets the typed reference data values by identifier.int
hashCode()
static ImmutableReferenceData.Meta
meta()
The meta-bean forImmutableReferenceData
.ImmutableReferenceData.Meta
metaBean()
static <T> ImmutableReferenceData
of(ReferenceDataId<T> id, T value)
Obtains an instance from a single reference data entry.static ImmutableReferenceData
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.String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.opengamma.strata.basics.ReferenceData
containsValue, findValue, getValue
-
-
-
-
Method Detail
-
of
public static ImmutableReferenceData of(Map<? extends ReferenceDataId<?>,?> values)
Obtains an instance from a map of reference data.Each entry in the map is a single piece of reference data, keyed by the matching identifier. For example, a
HolidayCalendarId
associated with aHolidayCalendar
. The caller must ensure that the each entry in the map corresponds with the parameterized type on the identifier.The resulting
ImmutableReferenceData
instance does not include the minimal set of reference data that is essential for pricing. To include the minimal set, useReferenceData.of(Map)
orcombinedWith(ReferenceData)
.- Parameters:
values
- the reference data values- Returns:
- the reference data instance
- Throws:
ClassCastException
- if a value does not match the parameterized type associated with the identifier
-
of
public static <T> ImmutableReferenceData of(ReferenceDataId<T> id, T value)
Obtains an instance from a single reference data entry.This returns an instance containing a single entry based on the specified identifier and value. This is primarily of interest to test cases.
The resulting
ImmutableReferenceData
instance does not include the minimal set of reference data that is essential for pricing.- Type Parameters:
T
- the type of the reference data- Parameters:
id
- the identifiervalue
- the reference data values- Returns:
- the reference data instance
- Throws:
ClassCastException
- if a value does not match the parameterized type associated with the identifier
-
empty
public static ImmutableReferenceData empty()
Obtains an instance containing no reference data.- Returns:
- empty reference data
-
queryValueOrNull
public <T> T queryValueOrNull(ReferenceDataId<T> id)
Description copied from interface:ReferenceData
Low-level method to query the reference data value associated with the specified identifier, returning null if not found.This is a low-level method that obtains the reference data value, returning null instead of an error. Applications should use
ReferenceData.getValue(ReferenceDataId)
in preference to this method.- Specified by:
queryValueOrNull
in interfaceReferenceData
- Type Parameters:
T
- the type of the reference data value- Parameters:
id
- the identifier to find- Returns:
- the reference data value, null if not found
-
combinedWith
public ReferenceData combinedWith(ReferenceData other)
Description copied from interface:ReferenceData
Combines this reference data with another.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.
- Specified by:
combinedWith
in interfaceReferenceData
- Parameters:
other
- the other reference data- Returns:
- the combined reference data
-
meta
public static ImmutableReferenceData.Meta meta()
The meta-bean forImmutableReferenceData
.- Returns:
- the meta-bean, not null
-
metaBean
public ImmutableReferenceData.Meta metaBean()
- Specified by:
metaBean
in interfaceorg.joda.beans.Bean
-
getValues
public ImmutableMap<ReferenceDataId<?>,Object> getValues()
Gets the typed reference data values by identifier.- Returns:
- the value of the property, not null
-
-