Class ImmutableReferenceData

    • 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 a HolidayCalendar. 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, use ReferenceData.of(Map) or combinedWith(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 identifier
        value - 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 interface ReferenceData
        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 interface ReferenceData
        Parameters:
        other - the other reference data
        Returns:
        the combined reference data
      • getValues

        public ImmutableMap<ReferenceDataId<?>,​Object> getValues()
        Gets the typed reference data values by identifier.
        Returns:
        the value of the property, not null
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object