- All Implemented Interfaces:
Holiday
Like a FloatingHoliday, the calendar date of an early close is
computed per year via an Observance. In addition, an early close
carries the local time at which trading ceases and the
time zone in which that time is expressed.
An early close is inherently non-rollable: it is tied
to the specific calendar day preceding the associated full holiday and is never
adjusted for weekend observance — e.g. a Christmas Eve early close always occurs
on Dec 24, never rolled to Dec 23 or Dec 26. Consequently, early closes are
excluded from HolidayCalendar.calculate(int) and are reported separately by
HolidayCalendar.calculateEarlyCloses(int).
Instances are immutable, thread-safe records constructed via
Holiday.builder() with Holiday.Type.EARLY_CLOSE:
Holiday christmasEveEarlyClose = Holiday.builder()
.name("Christmas Eve")
.description("NYSE 1:00pm ET early close")
.type(Holiday.Type.EARLY_CLOSE)
.rollable(false)
.observance(new ChristmasEveEarlyClose())
.closeTime(LocalTime.of(13, 0))
.zoneId(ZoneId.of("America/New_York"))
.build();
- Author:
- Dave Joyce
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.holiday.calendar.Holiday
Holiday.HolidayBuilder, Holiday.Type -
Constructor Summary
ConstructorsConstructorDescriptionEarlyCloseHoliday(String name, String description, Observance observance, LocalTime closeTime, ZoneId zoneId) Canonical constructor. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecloseTimerecord component.dateForYear(int year) Calculate the date of this holiday for the specified year.Returns the value of thedescriptionrecord component.final booleanIndicates whether some other object is "equal to" this one.Get the local time at which trading ceases on this early-close day.Get the description (if any) of this holiday.getName()Get the name of this holiday.Get the time zone in which this holiday'sclose timeis expressed.final inthashCode()Returns a hash code value for this object.booleanDetermine if this holiday supports date rolling for actual observance on a holiday calendar.name()Returns the value of thenamerecord component.Returns the value of theobservancerecord component.toString()Returns a string representation of this record class.zoneId()Returns the value of thezoneIdrecord component.
-
Constructor Details
-
EarlyCloseHoliday
public EarlyCloseHoliday(String name, String description, Observance observance, LocalTime closeTime, ZoneId zoneId) Canonical constructor.
-
-
Method Details
-
getName
Description copied from interface:HolidayGet the name of this holiday. -
getDescription
Description copied from interface:HolidayGet the description (if any) of this holiday.- Specified by:
getDescriptionin interfaceHoliday- Returns:
- holiday description
-
isRollable
public boolean isRollable()Determine if this holiday supports date rolling for actual observance on a holiday calendar.An early close is always non-rollable; this method always returns
false.- Specified by:
isRollablein interfaceHoliday- Returns:
trueif the date of occurrence for this holiday may be rolled for observance,falseotherwise
-
getObservance
-
getCloseTime
Get the local time at which trading ceases on this early-close day.- Returns:
- early close time, expressed in the
zoneof this holiday
-
getZoneId
Get the time zone in which this holiday'sclose timeis expressed.- Returns:
- early close time zone
-
dateForYear
Description copied from interface:HolidayCalculate the date of this holiday for the specified year. The date returned by this method may be adjusted to a different date of observance by the associatedholiday calendar.- Specified by:
dateForYearin interfaceHoliday- Parameters:
year- full calendar year (e.g. 1977, 2021)- Returns:
- date of this holiday, or
emptyif not observed on the specified year
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
description
Returns the value of thedescriptionrecord component.- Returns:
- the value of the
descriptionrecord component
-
observance
Returns the value of theobservancerecord component.- Returns:
- the value of the
observancerecord component
-
closeTime
Returns the value of thecloseTimerecord component.- Returns:
- the value of the
closeTimerecord component
-
zoneId
Returns the value of thezoneIdrecord component.- Returns:
- the value of the
zoneIdrecord component
-