diff --git a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/ChristianHoliday.java b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/ChristianHoliday.java index c2705224a..b6a2404f1 100644 --- a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/ChristianHoliday.java +++ b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/ChristianHoliday.java @@ -2,8 +2,37 @@ import java.time.chrono.Chronology; +/** + * Represents a christian holiday that can be + * + * + * + * and has a special {@link ChristianHolidayType} and a chronology based on {@link Chronology}. + * Two chronologies are supported: + * + * + * The {@link de.focus_shift.jollyday.core.parser.impl.ChristianHolidayParser} is used. + */ public interface ChristianHoliday extends Limited, Described, Movable { + + /** + * Describes the {@link ChristianHolidayType} + * + * @return the type of the christian holiday + */ ChristianHolidayType type(); + /** + * Describes the {@link Chronology} of the christian holiday + * + * @return the chronology of the christian holiday + */ Chronology chronology(); } diff --git a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/Configuration.java b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/Configuration.java index fba908d66..3a1d024fa 100644 --- a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/Configuration.java +++ b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/Configuration.java @@ -3,16 +3,45 @@ import java.util.stream.Stream; /** - * Represents the configuration. + * Represents the holiday configuration, meta information like the hierarchy and description + * and the sub configuration for a specific {@link de.focus_shift.jollyday.core.HolidayCalendar}. + * */ public interface Configuration { - Holidays holidays(); - - Stream subConfigurations(); - + /** + * Contains the ISO 3166-1 alpha-2 for countries or ISO 3166-2 code for subdivisions + * + * @return the code of this configuration + */ String hierarchy(); + /** + * Contains further information like the name. + * + * @return the description of this configuration + */ String description(); + /** + * Contains all holiday configuration of different types like {@link Fixed} or {@link ChristianHoliday} e.g. + * + * @return all holiday configuration for this {@link de.focus_shift.jollyday.core.HolidayCalendar} + */ + Holidays holidays(); + + /** + * Contains the holiday configuration for subdivisions, cities, ... of the main configuration. + * The hierarchy is built on top of the iso standard. For germany e.g. there is a main configuration for Germany + * and 16 sub configurations for the subdivisions. + * + * @return all configurations for the next hierarchy level like subdivisions or cities. + */ + Stream subConfigurations(); + } diff --git a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/ConfigurationService.java b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/ConfigurationService.java index cb43f482b..1fdbf03bb 100644 --- a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/ConfigurationService.java +++ b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/ConfigurationService.java @@ -8,4 +8,5 @@ public interface ConfigurationService { Configuration getConfiguration(ManagerParameter parameter); + } diff --git a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/Described.java b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/Described.java index 635de5a2a..75e1c553f 100644 --- a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/Described.java +++ b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/Described.java @@ -2,8 +2,25 @@ import de.focus_shift.jollyday.core.HolidayType; +/** + * Provides the functionality to describe a holiday with a + * name represented by the `descriptionPropertiesKey` and a + * `officiality` holiday type that can be one of the provides {@link HolidayType}s + */ public interface Described { + + /** + * The properties key will be used to translate the holiday into the requested language + * + * @return the properties key to use to translate + */ String descriptionPropertiesKey(); + /** + * Represents the type of the holiday. + * Different holiday types are available in {@link HolidayType} + * + * @return the holiday type + */ HolidayType officiality(); } diff --git a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/EthiopianOrthodoxHoliday.java b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/EthiopianOrthodoxHoliday.java index 172510004..92bb24d70 100644 --- a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/EthiopianOrthodoxHoliday.java +++ b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/EthiopianOrthodoxHoliday.java @@ -1,5 +1,24 @@ package de.focus_shift.jollyday.core.spi; +/** + * Represents an ethiopian orthodox holiday that can be + * + * + * + * and has a special {@link EthiopianOrthodoxHolidayType}. + * The {@link de.focus_shift.jollyday.core.parser.impl.EthiopianOrthodoxHolidayParser} is used. + * + */ public interface EthiopianOrthodoxHoliday extends Described, Limited { + + /** + * Describes the {@link EthiopianOrthodoxHolidayType} + * + * @return the type of the ethiopian orthodox holiday + */ EthiopianOrthodoxHolidayType type(); + } diff --git a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/Fixed.java b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/Fixed.java index 008ed99f6..32e2118bb 100644 --- a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/Fixed.java +++ b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/Fixed.java @@ -3,5 +3,7 @@ import java.time.MonthDay; public interface Fixed extends Described, Movable, Limited { + MonthDay day(); + } diff --git a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/FixedWeekdayBetweenFixed.java b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/FixedWeekdayBetweenFixed.java index 374e1110a..0a27bca4d 100644 --- a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/FixedWeekdayBetweenFixed.java +++ b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/FixedWeekdayBetweenFixed.java @@ -3,9 +3,11 @@ import java.time.DayOfWeek; public interface FixedWeekdayBetweenFixed extends Described, Limited { + Fixed from(); Fixed to(); DayOfWeek weekday(); + } diff --git a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/FixedWeekdayInMonth.java b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/FixedWeekdayInMonth.java index b1c7da63f..23086af5b 100644 --- a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/FixedWeekdayInMonth.java +++ b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/FixedWeekdayInMonth.java @@ -4,9 +4,11 @@ import java.time.Month; public interface FixedWeekdayInMonth extends Described, Limited { + DayOfWeek weekday(); Month month(); Occurrance which(); + } diff --git a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/FixedWeekdayRelativeToFixed.java b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/FixedWeekdayRelativeToFixed.java index 64ebe557a..aabed41bc 100644 --- a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/FixedWeekdayRelativeToFixed.java +++ b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/FixedWeekdayRelativeToFixed.java @@ -3,6 +3,7 @@ import java.time.DayOfWeek; public interface FixedWeekdayRelativeToFixed extends Described, Limited { + Fixed day(); Occurrance which(); @@ -10,4 +11,5 @@ public interface FixedWeekdayRelativeToFixed extends Described, Limited { DayOfWeek weekday(); Relation when(); + } diff --git a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/IslamicHoliday.java b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/IslamicHoliday.java index 1d4b1485b..a4e538d63 100644 --- a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/IslamicHoliday.java +++ b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/IslamicHoliday.java @@ -1,5 +1,19 @@ package de.focus_shift.jollyday.core.spi; +/** + * Represents a islamic holiday that can be + * + * + * + * and has a special {@link IslamicHolidayType}. + * The {@link de.focus_shift.jollyday.core.parser.impl.IslamicHolidayParser} is used. + */ public interface IslamicHoliday extends Described, Limited, Movable { + IslamicHolidayType type(); + } diff --git a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/Limited.java b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/Limited.java index bacade4a9..0ac9ce8a8 100644 --- a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/Limited.java +++ b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/Limited.java @@ -2,10 +2,44 @@ import java.time.Year; +/** + * Provides the functionality to limit the years a holiday will occur. + * By default, a holiday will occur on every year it is requested until + * this interface will be used and valid from or valid to is set, then the + * holiday will only occur in this year's. If the cycle is set, a holiday will + * only occur in the years represented by the cycle. + *

+ * Example: + * if a holiday is only valid from 1900 until 1910 and a cycle from five years + * is configured, then the holiday will occur in the years: + *

+ */ public interface Limited { + + /** + * Describes the first year a holiday is valid (inclusive) + * + * @return the first valid year of a holiday + */ Year validFrom(); + /** + * Describes the last year a holiday is valid (inclusive) + * + * @return the last valid year of a holiday + */ Year validTo(); + /** + * Describes the cycle a holiday is valid in between the + * years given bei from and to. + * + * @return the cycle to limit a holiday between from and to + */ YearCycle cycle(); + } diff --git a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/Movable.java b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/Movable.java index 0e68b0155..22868fe04 100644 --- a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/Movable.java +++ b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/Movable.java @@ -3,5 +3,13 @@ import java.util.List; public interface Movable { + + /** + * Describes the different moving conditions that + * have been configured for a specific holiday. + * + * @return the configured {@link MovingCondition} for this holiday + */ List conditions(); + } diff --git a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/MovingCondition.java b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/MovingCondition.java index c1ac6eac0..de5e78a8f 100644 --- a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/MovingCondition.java +++ b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/MovingCondition.java @@ -3,9 +3,11 @@ import java.time.DayOfWeek; public interface MovingCondition { + DayOfWeek substitute(); With with(); DayOfWeek weekday(); + } diff --git a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/RelativeToEasterSunday.java b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/RelativeToEasterSunday.java index 66f6d31d7..813e04efa 100644 --- a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/RelativeToEasterSunday.java +++ b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/RelativeToEasterSunday.java @@ -5,7 +5,9 @@ import java.time.chrono.Chronology; public interface RelativeToEasterSunday extends Described, Limited { + Chronology chronology(); Days days(); + } diff --git a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/RelativeToFixed.java b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/RelativeToFixed.java index 70d459c88..e7adfa40f 100644 --- a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/RelativeToFixed.java +++ b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/RelativeToFixed.java @@ -5,6 +5,7 @@ import java.time.DayOfWeek; public interface RelativeToFixed extends Described, Limited { + Fixed date(); DayOfWeek weekday(); @@ -12,4 +13,5 @@ public interface RelativeToFixed extends Described, Limited { Relation when(); Days days(); + } diff --git a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/RelativeToWeekdayInMonth.java b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/RelativeToWeekdayInMonth.java index 4b4c384ab..0f31ac70d 100644 --- a/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/RelativeToWeekdayInMonth.java +++ b/jollyday-core/src/main/java/de/focus_shift/jollyday/core/spi/RelativeToWeekdayInMonth.java @@ -3,9 +3,11 @@ import java.time.DayOfWeek; public interface RelativeToWeekdayInMonth extends Described, Limited { + FixedWeekdayInMonth weekdayInMonth(); DayOfWeek weekday(); Relation when(); + } diff --git a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/CalendarCheckerApi.java b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/CalendarCheckerApi.java index ab90d254a..9086800e6 100644 --- a/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/CalendarCheckerApi.java +++ b/jollyday-tests/src/test/java/de/focus_shift/jollyday/tests/CalendarCheckerApi.java @@ -15,7 +15,7 @@ public interface CalendarCheckerApi { *

* Calling multiple methods on the returned {@link CalendarChecker} is safe as it only interacts with the {@link CalendarCheckerApi} *

- * Examples: + * Example: *

 // you can chain multiple holiday checks
    * assertFor(GERMANY)
    *   .hasFixedHoliday("NEW_YEAR", JANUARY, 1).and()