- java.lang.Object
-
- de.focus_shift.jollyday.core.Holiday
-
- All Implemented Interfaces:
Comparable<Holiday>
public final class Holiday extends Object implements Comparable<Holiday>
Represents the holiday and contains the actual date and an localized description.
-
-
Constructor Summary
Constructors Constructor Description Holiday(LocalDate date, String propertiesKey, HolidayType type)Constructs a holiday for a date using the provided properties key to retrieve the description with.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(Holiday other)Compares this holiday to another holiday.booleanequals(Object obj)LocalDategetDate()Getter for the fielddate.StringgetDescription()The description read with the default locale.StringgetDescription(Locale locale)The description read with the provided locale.StringgetPropertiesKey()Getter for the fieldpropertiesKey.HolidayTypegetType()Gets the type holiday.inthashCode()StringtoString()
-
-
-
Constructor Detail
-
Holiday
public Holiday(LocalDate date, String propertiesKey, HolidayType type)
Constructs a holiday for a date using the provided properties key to retrieve the description with.- Parameters:
date- aLocalDateobject.propertiesKey- aStringobject.type- aHolidayTypeobject.
-
-
Method Detail
-
getDate
public LocalDate getDate()
Getter for the field
date.- Returns:
- the holiday date
-
getPropertiesKey
public String getPropertiesKey()
Getter for the field
propertiesKey.- Returns:
- the holidays properties key
-
getDescription
public String getDescription()
The description read with the default locale.- Returns:
- Description for this holiday
-
getDescription
public String getDescription(Locale locale)
The description read with the provided locale.- Parameters:
locale- aLocaleobject.- Returns:
- Description for this holiday
-
getType
public HolidayType getType()
Gets the type holiday.- Returns:
- the type holiday
-
compareTo
public int compareTo(Holiday other)
Compares this holiday to another holiday.The comparison is primarily based on the date, from earliest to latest by using the LocalDate comparator.
- Specified by:
compareToin interfaceComparable<Holiday>- Parameters:
other- the other holiday to compare to, not null- Returns:
- the comparator value, negative if less, positive if greater
-
-