public final class HolidayCalendarId extends Object implements ReferenceDataId<HolidayCalendar>, Resolvable<HolidayCalendar>, Named, Serializable
This identifier is used to obtain a HolidayCalendar from ReferenceData.
The holiday calendar itself is used to determine whether a day is a business day or not.
Identifiers for common holiday calendars are provided in HolidayCalendarIds.
| Modifier and Type | Method and Description |
|---|---|
HolidayCalendarId |
combinedWith(HolidayCalendarId other)
Combines this holiday calendar identifier with another.
|
static HolidayCalendarId |
defaultByCurrency(Currency currency)
Gets the default calendar for a currency.
|
static HolidayCalendarId |
defaultByCurrencyPair(CurrencyPair currencyPair)
Gets the default calendar for a pair of currencies.
|
boolean |
equals(Object obj)
Checks if this identifier equals another identifier.
|
static Optional<HolidayCalendarId> |
findDefaultByCurrency(Currency currency)
Tries to find a default calendar for a currency.
|
String |
getName()
Gets the name that uniquely identifies this calendar.
|
Class<HolidayCalendar> |
getReferenceDataType()
Gets the type of data this identifier refers to.
|
int |
hashCode()
Returns a suitable hash code for the identifier.
|
static boolean |
isCompositeCalendar(HolidayCalendarId id)
Checks if the holiday calendar is a combined or linked calendar.
|
HolidayCalendarId |
linkedWith(HolidayCalendarId other)
Combines this holiday calendar identifier with another.
|
static HolidayCalendarId |
of(String uniqueName)
Obtains an instance from the specified unique name.
|
HolidayCalendar |
queryValueOrNull(ReferenceData refData)
Low-level method to query the reference data value associated with this identifier,
returning null if not found.
|
HolidayCalendar |
resolve(ReferenceData refData)
Resolves this identifier to a holiday calendar using the specified reference data.
|
String |
toString()
Returns the name of the identifier.
|
public static HolidayCalendarId of(String uniqueName)
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.
uniqueName - the unique namepublic static HolidayCalendarId defaultByCurrency(Currency currency)
This uses data from HolidayCalendarDefaultData.ini to provide a default.
currency - the currency to find the default forIllegalArgumentException - if there is no default for the currencypublic static Optional<HolidayCalendarId> findDefaultByCurrency(Currency currency)
This uses data from HolidayCalendarDefaultData.ini to provide a default.
currency - the currency to find the default forpublic static HolidayCalendarId defaultByCurrencyPair(CurrencyPair currencyPair)
This uses data from HolidayCalendarDefaultData.ini to provide a default.
If no calendar is found, the 'NoHolidays' calendar is used as the default.
currencyPair - the currency pair to find the defaults forpublic static boolean isCompositeCalendar(HolidayCalendarId id)
id - the holiday calendar idpublic String getName()
This name is used in serialization and can be parsed using of(String).
public Class<HolidayCalendar> getReferenceDataType()
A HolidayCalendarId refers to a HolidayCalendar.
getReferenceDataType in interface ReferenceDataId<HolidayCalendar>public HolidayCalendar resolve(ReferenceData refData)
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.
resolve in interface Resolvable<HolidayCalendar>refData - the reference data, used to resolve the referenceReferenceDataNotFoundException - if the identifier is not foundpublic HolidayCalendar queryValueOrNull(ReferenceData refData)
ReferenceDataId
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.
queryValueOrNull in interface ReferenceDataId<HolidayCalendar>refData - the reference data to lookup the value inpublic HolidayCalendarId combinedWith(HolidayCalendarId other)
The resulting calendar will declare a day as a business day if it is a business day in both source calendars.
other - the other holiday calendar identifierpublic HolidayCalendarId linkedWith(HolidayCalendarId other)
The resulting calendar will declare a day as a business day if it is a business day in either source calendar.
other - the other holiday calendar identifierpublic boolean equals(Object obj)
The comparison checks the name.
public int hashCode()
Copyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.