Holger's Java API

## com.antelmann.calendar
Class Holiday

    java.lang.Object
      com.antelmann.calendar.Holiday

All Implemented Interfaces:
  Localizable, Serializable, Comparable<Holiday>

    public class Holiday

extends Object
implements Serializable, Comparable<Holiday>, Localizable

represents a holiday

Since:
  Feb 2006
Author:
  Holger Antelmann
See Also:
  `HolidayCalendar`, Serialized Form

Nested Class Summary

Nested classes/interfaces inherited from interface com.antelmann.util.Localizable
`Localizable.Adapter`

Constructor Summary
`Holiday(String name, Date date)` calls `this(name, date, true, null)`
`Holiday(String name, Date date, boolean isPublic, Locale locale)`

Method Summary
`int` `compareTo(Holiday h)` based on the date
`boolean` `equals(Object obj)` based on both, name and date
`Date` `getDate()` the date is stored as the beginning of the corresponding day
`Locale` `getLocale()` returns the locale associated with this holiday.
`String` `getName()`
`int` `hashCode()`
`boolean` `isPublic()` determines whether this holiday is considered to be a so-called bank holiday
`boolean` `isSameDay(Date date)`
`void` `setLocale(Locale locale, Object context)` sets the Locale for this object so that all subsequent return values of method calls to this instance can be localized accordingly until a different Locale is set.
`String` `toString()` returns the localized date along with the name

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Holiday

    public Holiday(String name,
                   Date date)

  calls `this(name, date, true, null)`

### Holiday

    public Holiday(String name,
                   Date date,
                   boolean isPublic,
                   Locale locale)

Method Detail

### getName

    public String getName()

### getDate

    public Date getDate()

  the date is stored as the beginning of the corresponding day

  See Also:
    `CalendarHelper.dayBegin(Date)`

### isSameDay

    public boolean isSameDay(Date date)

### isPublic

    public boolean isPublic()

  determines whether this holiday is considered to be a so-called bank holiday

### getLocale

    public Locale getLocale()

  returns the locale associated with this holiday. If the return value is null, this holiday is considered to be globally valid

  Specified by:
    `getLocale` in interface `Localizable`
  Returns:
    the current Locale that this instance uses to determine return values for its methods; if null is returned, this instance is expected to use the default Locale of the system.
  See Also:
    `Localizable.setLocale(Locale, Object)`

### setLocale

    public void setLocale(Locale locale,
                          Object context)
                   throws ResourceNotFoundException

  Description copied from interface: `Localizable`
  sets the Locale for this object so that all subsequent return values of method calls to this instance can be localized accordingly until a different Locale is set.

  Specified by:
    `setLocale` in interface `Localizable`
  Parameters:
    `locale` - the Locale that is to be used to determine return values for all methods of this instance; if set to null, the default locale is to be used.
    `context` - a context that may be required for this instance to load the resources for the given locale; this context may be null for objects that do not require an external context. Examples of a context may be a database, a resource file, some map or no context at all.
  Throws:
    `ResourceNotFoundException` - if a required resource to handle the given locale could not be loaded
  See Also:
    `Localizable.getLocale()`

### compareTo

    public int compareTo(Holiday h)

  based on the date

  Specified by:
    `compareTo` in interface `Comparable<Holiday>`

### toString

    @Localized
    public String toString()

  returns the localized date along with the name

  Overrides:
    `toString` in class `Object`

### hashCode

    public int hashCode()

  Overrides:
    `hashCode` in class `Object`

### equals

    public boolean equals(Object obj)

  based on both, name and date

  Overrides:
    `equals` in class `Object`

(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads