Top Description Fields Constructors Methods
com.ibm.icu.util

public abstract Class Holiday

extends Object
implements DateRule
Class Inheritance
All Implemented Interfaces
com.ibm.icu.util.DateRule
Known Direct Subclasses
com.ibm.icu.util.EasterHoliday, com.ibm.icu.util.SimpleHoliday, com.ibm.icu.util.HebrewHoliday
Imports
java.util.Date, .Locale, .MissingResourceException, .ResourceBundle, com.ibm.icu.util.ULocale.Category

Note

The Holiday framework is a technology preview. Despite its age, is still draft API, and clients should treat it as such. An abstract class representing a holiday.

ICU Status
Draft since ICU 2.8 (retainAll).

Field Summary

Modifier and TypeField and Description
private String
private static Holiday[]
private DateRule

Constructor Summary

AccessConstructor and Description
protected
Holiday(String
The name of this holiday. The getDisplayName method uses this string as a key to look up the holiday's name a resource bundle object named HolidayBundle.
name
,
DateRule
The date rules used for determining when this holiday falls. Holiday's implementation of the DateRule interface simply delegates to this DateRule object.
rule
)

Construct a new Holiday object.

Method Summary

Modifier and TypeMethod and Description
public Date

Returns:

The date on which this holiday occurs, or null if it does not occur on or after the start date.
firstAfter
(Date
Only holidays on or after this date are returned.
start
)

Implements com.ibm.icu.util.DateRule.firstAfter.

Return the first occurrence of this holiday on or after the given date
public Date

Returns:

The date on which this event occurs, or null if it does not occur between the start and end dates.
firstBetween
(Date
Only occurrences on or after this date are returned.
start
,
Date
Only occurrences before this date are returned.
end
)

Implements com.ibm.icu.util.DateRule.firstBetween.

Return the first occurrence of this holiday that is on or after the given start date and before the given end date.
public String
getDisplayName()

Return the name of this holiday in the language of the default DISPLAY locale.

public String
getDisplayName(Locale
A locale specifying the language in which the name is desired.
locale
)

Return the name of this holiday in the language of the specified locale.

public String
getDisplayName(ULocale
A locale specifying the language in which the name is desired.
locale
)

Return the name of this holiday in the language of the specified locale The name parameter passed to this object's constructor is used as a key to look up the holiday's localized name in a ResourceBundle object named HolidayBundle.

public static Holiday[]
public static Holiday[]
public static Holiday[]
public DateRule
public boolean
isBetween(Date start, Date end)

Implements com.ibm.icu.util.DateRule.isBetween.

Check whether this holiday occurs at least once between the two dates given.
public boolean

Returns:

true if this holiday occurs on the given date.
isOn
(Date
The date to check.
date
)

Implements com.ibm.icu.util.DateRule.isOn.

Checks whether this holiday falls on the given date.
public void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nameback to summary
private String name
noHolidaysback to summary
private static Holiday[] noHolidays
ruleback to summary
private DateRule rule

Constructor Detail

Holidayback to summary
protected Holiday(String name, DateRule rule)

Construct a new Holiday object. This is for use by subclasses only. This constructs a new holiday with the given name and date rules.

Parameters
name:String

The name of this holiday. The getDisplayName method uses this string as a key to look up the holiday's name a resource bundle object named HolidayBundle.

rule:DateRule

The date rules used for determining when this holiday falls. Holiday's implementation of the DateRule interface simply delegates to this DateRule object.

ICU Status
Draft since ICU 2.8.

Method Detail

firstAfterback to summary
public Date firstAfter(Date start)

Implements com.ibm.icu.util.DateRule.firstAfter.

Return the first occurrence of this holiday on or after the given date

Parameters
start:Date

Only holidays on or after this date are returned.

Returns:Date

The date on which this holiday occurs, or null if it does not occur on or after the start date.

Annotations
@Override
ICU Status
Draft since ICU 2.8.
See Also
firstBetween
firstBetweenback to summary
public Date firstBetween(Date start, Date end)

Implements com.ibm.icu.util.DateRule.firstBetween.

Return the first occurrence of this holiday that is on or after the given start date and before the given end date.

Parameters
start:Date

Only occurrences on or after this date are returned.

end:Date

Only occurrences before this date are returned.

Returns:Date

The date on which this event occurs, or null if it does not occur between the start and end dates.

Annotations
@Override
ICU Status
Draft since ICU 2.8.
See Also
firstAfter
getDisplayNameback to summary
public String getDisplayName()

Return the name of this holiday in the language of the default DISPLAY locale.

ICU Status
Draft since ICU 2.8.
See Also
Category#DISPLAY
getDisplayNameback to summary
public String getDisplayName(Locale locale)

Return the name of this holiday in the language of the specified locale. The name parameter passed to this object's constructor is used as a key to look up the holiday's localized name in a ResourceBundle object named HolidayBundle.

Parameters
locale:Locale

A locale specifying the language in which the name is desired.

ICU Status
Draft since ICU 2.8.
See Also
ResourceBundle
getDisplayNameback to summary
public String getDisplayName(ULocale locale)

Return the name of this holiday in the language of the specified locale The name parameter passed to this object's constructor is used as a key to look up the holiday's localized name in a ResourceBundle object named HolidayBundle.

Parameters
locale:ULocale

A locale specifying the language in which the name is desired.

ICU Status
Draft since ICU 3.2.
See Also
ResourceBundle
getHolidaysback to summary
public static Holiday[] getHolidays()
ICU Status
Draft since ICU 2.8.
getHolidaysback to summary
public static Holiday[] getHolidays(Locale locale)
ICU Status
Draft since ICU 2.8.
getHolidaysback to summary
public static Holiday[] getHolidays(ULocale locale)
ICU Status
Draft since ICU 3.2.
getRuleback to summary
public DateRule getRule()
ICU Status
Draft since ICU 2.8.
isBetweenback to summary
public boolean isBetween(Date start, Date end)

Implements com.ibm.icu.util.DateRule.isBetween.

Check whether this holiday occurs at least once between the two dates given.

Annotations
@Override
ICU Status
Draft since ICU 2.8.
isOnback to summary
public boolean isOn(Date date)

Implements com.ibm.icu.util.DateRule.isOn.

Checks whether this holiday falls on the given date. This does not take time of day into account; instead it checks whether the holiday and the given date are on the same day.

Parameters
date:Date

The date to check.

Returns:boolean

true if this holiday occurs on the given date.

Annotations
@Override
ICU Status
Draft since ICU 2.8.
setRuleback to summary
public void setRule(DateRule rule)
ICU Status
Draft since ICU 2.8.