Skip to content

Commit

Permalink
improve the javadoc for the spi package
Browse files Browse the repository at this point in the history
  • Loading branch information
derTobsch committed Dec 23, 2024
1 parent 1f35e58 commit fd2d39d
Show file tree
Hide file tree
Showing 17 changed files with 173 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,37 @@

import java.time.chrono.Chronology;

/**
* Represents a christian holiday that can be
*
* <ul>
* <li>Movable</li>
* <li>Limited</li>
* <li>Described</li>
* </ul>
*
* and has a special {@link ChristianHolidayType} and a chronology based on {@link Chronology}.
* Two chronologies are supported:
* <ul>
* <li>ISO</li>
* <li>Julian</li>
* </ul>
*
* 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();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
* <ul>
* <li>The `holidays` contains the holiday configuration for every holiday.</li>
* <li>The `hierarchy` contains the ISO 3166-1 alpha-2 for countries or ISO 3166-2 code for subdivisions.</li>
* <li>The `description` contains further information.</li>
* <li>The `subConfiguration` contains the holiday configuration for subdivisions, cities, ... of the main configuration.</li>
* </ul>
*/
public interface Configuration {

Holidays holidays();

Stream<Configuration> 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<Configuration> subConfigurations();

}
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@
public interface ConfigurationService {

Configuration getConfiguration(ManagerParameter parameter);

}
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
package de.focus_shift.jollyday.core.spi;

/**
* Represents an ethiopian orthodox holiday that can be
*
* <ul>
* <li>Limited</li>
* <li>Described</li>
* </ul>
*
* 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();

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
import java.time.MonthDay;

public interface Fixed extends Described, Movable, Limited {

MonthDay day();

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import java.time.DayOfWeek;

public interface FixedWeekdayBetweenFixed extends Described, Limited {

Fixed from();

Fixed to();

DayOfWeek weekday();

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@
import java.time.Month;

public interface FixedWeekdayInMonth extends Described, Limited {

DayOfWeek weekday();

Month month();

Occurrance which();

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
import java.time.DayOfWeek;

public interface FixedWeekdayRelativeToFixed extends Described, Limited {

Fixed day();

Occurrance which();

DayOfWeek weekday();

Relation when();

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
package de.focus_shift.jollyday.core.spi;

/**
* Represents a islamic holiday that can be
*
* <ul>
* <li>Movable</li>
* <li>Limited</li>
* <li>Described</li>
* </ul>
*
* 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();

}
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* <p>
* 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:
* <ul>
* <li>1900</li>
* <li>1905</li>
* <li>1910</li>
* </ul>
*/
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();

}
Original file line number Diff line number Diff line change
Expand Up @@ -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<MovingCondition> conditions();

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import java.time.DayOfWeek;

public interface MovingCondition {

DayOfWeek substitute();

With with();

DayOfWeek weekday();

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
import java.time.chrono.Chronology;

public interface RelativeToEasterSunday extends Described, Limited {

Chronology chronology();

Days days();

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
import java.time.DayOfWeek;

public interface RelativeToFixed extends Described, Limited {

Fixed date();

DayOfWeek weekday();

Relation when();

Days days();

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import java.time.DayOfWeek;

public interface RelativeToWeekdayInMonth extends Described, Limited {

FixedWeekdayInMonth weekdayInMonth();

DayOfWeek weekday();

Relation when();

}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public interface CalendarCheckerApi {
* <p>
* Calling multiple methods on the returned {@link CalendarChecker} is safe as it only interacts with the {@link CalendarCheckerApi}
* <p>
* Examples:
* Example:
* <pre><code class='java'> // you can chain multiple holiday checks
* assertFor(GERMANY)
* .hasFixedHoliday("NEW_YEAR", JANUARY, 1).and()
Expand Down

0 comments on commit fd2d39d

Please sign in to comment.