Class HolidayCalendarId

    • Method Detail

      • of

        public static HolidayCalendarId of​(java.lang.String uniqueName)
        Obtains an instance from the specified unique name.

        The name uniquely identifies the calendar. The HolidayCalendar is resolved from ReferenceData when required.

        It is possible to combine two or more calendars using the '+' symbol. For example, 'GBLO+USNY' will combine the separate 'GBLO' and 'USNY' calendars. The resulting identifier will have the individual identifiers normalized into alphabetical order.

        Parameters:
        uniqueName - the unique name
        Returns:
        the identifier
      • defaultByCurrency

        public static HolidayCalendarId defaultByCurrency​(Currency currency)
        Gets the default calendar for a currency.

        This uses data from HolidayCalendarDefaultData.ini to provide a default.

        Parameters:
        currency - the currency to find the default for
        Returns:
        the holiday calendar
        Throws:
        java.lang.IllegalArgumentException - if there is no default for the currency
      • getName

        public java.lang.String getName()
        Gets the name that uniquely identifies this calendar.

        This name is used in serialization and can be parsed using of(String).

        Specified by:
        getName in interface Named
        Returns:
        the unique name
      • getReferenceDataType

        public java.lang.Class<HolidayCalendar> getReferenceDataType()
        Gets the type of data this identifier refers to.

        A HolidayCalendarId refers to a HolidayCalendar.

        Specified by:
        getReferenceDataType in interface ReferenceDataId<HolidayCalendar>
        Returns:
        the type of the reference data this identifier refers to
      • resolve

        public HolidayCalendar resolve​(ReferenceData refData)
        Resolves this identifier to a holiday calendar using the specified reference data.

        This returns an instance of HolidayCalendar that can perform calculations.

        Resolved objects may be bound to data that changes over time, such as holiday calendars. If the data changes, such as the addition of a new holiday, the resolved form will not be updated. Care must be taken when placing the resolved form in a cache or persistence layer.

        Specified by:
        resolve in interface Resolvable<HolidayCalendar>
        Parameters:
        refData - the reference data, used to resolve the reference
        Returns:
        the resolved holiday calendar
        Throws:
        ReferenceDataNotFoundException - if the identifier is not found
      • queryValueOrNull

        public HolidayCalendar queryValueOrNull​(ReferenceData refData)
        Description copied from interface: ReferenceDataId
        Low-level method to query the reference data value associated with this 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 ReferenceDataId<HolidayCalendar>
        Parameters:
        refData - the reference data to lookup the value in
        Returns:
        the reference data value, null if not found
      • combinedWith

        public HolidayCalendarId combinedWith​(HolidayCalendarId other)
        Combines this holiday calendar identifier with another.

        The resulting calendar will declare a day as a business day if it is a business day in both source calendars.

        Parameters:
        other - the other holiday calendar identifier
        Returns:
        the combined holiday calendar identifier
      • equals

        public boolean equals​(java.lang.Object obj)
        Checks if this identifier equals another identifier.

        The comparison checks the name.

        Overrides:
        equals in class java.lang.Object
        Parameters:
        obj - the other identifier, null returns false
        Returns:
        true if equal
      • hashCode

        public int hashCode()
        Returns a suitable hash code for the identifier.
        Overrides:
        hashCode in class java.lang.Object
        Returns:
        the hash code
      • toString

        public java.lang.String toString()
        Returns the name of the identifier.
        Overrides:
        toString in class java.lang.Object
        Returns:
        the name