Package fr.marcwrobel.jbanking.calendar
Enum ShiftingStrategy
- java.lang.Object
-
- java.lang.Enum<ShiftingStrategy>
-
- fr.marcwrobel.jbanking.calendar.ShiftingStrategy
-
- All Implemented Interfaces:
Serializable,Comparable<ShiftingStrategy>
public enum ShiftingStrategy extends Enum<ShiftingStrategy>
Holidays shifting strategies.- Since:
- 2.1.0
- Author:
- Marc Wrobel
-
-
Enum Constant Summary
Enum Constants Enum Constant Description CLOSEST_WEEKDAYForHolidays that are observed on the precedingDayOfWeek.FRIDAYwhen they fall onDayOfWeek.SATURDAY, or on the followingDayOfWeek.MONDAYwhen they fall onDayOfWeek.SUNDAY.PLUS_TWO_DAYSForHolidays that are observed on the followingDayOfWeek.MONDAYwhen they fall onDayOfWeek.SATURDAY, or on the followingDayOfWeek.TUESDAYwhen they fall onDayOfWeek.SUNDAY.SUNDAY_TO_MONDAYForHolidays that are observed on the followingDayOfWeek.MONDAYwhen they fall onDayOfWeek.SUNDAY.SUNDAY_TO_TUESDAYForHolidays that are observed on the followingDayOfWeek.TUESDAYwhen they fall onDayOfWeek.SUNDAY.SUNDAY_TO_WEDNESDAYForHolidays that are observed on the followingDayOfWeek.WEDNESDAYwhen they fall onDayOfWeek.SUNDAY.WEEKEND_TO_MONDAYForHolidays that are observed on the followingDayOfWeek.MONDAYwhen they fall onDayOfWeek.SATURDAYorDayOfWeek.SUNDAY.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract LocalDateshift(LocalDate localDate)Shift the given date.abstract LocalDate[]unshift(LocalDate localDate)Unshift the given date.static ShiftingStrategyvalueOf(String name)Returns the enum constant of this type with the specified name.static ShiftingStrategy[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
CLOSEST_WEEKDAY
public static final ShiftingStrategy CLOSEST_WEEKDAY
ForHolidays that are observed on the precedingDayOfWeek.FRIDAYwhen they fall onDayOfWeek.SATURDAY, or on the followingDayOfWeek.MONDAYwhen they fall onDayOfWeek.SUNDAY.This strategy is useful for American holidays.
-
PLUS_TWO_DAYS
public static final ShiftingStrategy PLUS_TWO_DAYS
ForHolidays that are observed on the followingDayOfWeek.MONDAYwhen they fall onDayOfWeek.SATURDAY, or on the followingDayOfWeek.TUESDAYwhen they fall onDayOfWeek.SUNDAY.This strategy is useful for United Kingdom holidays.
-
SUNDAY_TO_MONDAY
public static final ShiftingStrategy SUNDAY_TO_MONDAY
ForHolidays that are observed on the followingDayOfWeek.MONDAYwhen they fall onDayOfWeek.SUNDAY.This strategy is useful for US holidays.
-
SUNDAY_TO_TUESDAY
public static final ShiftingStrategy SUNDAY_TO_TUESDAY
ForHolidays that are observed on the followingDayOfWeek.TUESDAYwhen they fall onDayOfWeek.SUNDAY.This strategy is useful for Japanese holidays.
-
SUNDAY_TO_WEDNESDAY
public static final ShiftingStrategy SUNDAY_TO_WEDNESDAY
ForHolidays that are observed on the followingDayOfWeek.WEDNESDAYwhen they fall onDayOfWeek.SUNDAY.This strategy is useful for Japanese holidays.
-
WEEKEND_TO_MONDAY
public static final ShiftingStrategy WEEKEND_TO_MONDAY
ForHolidays that are observed on the followingDayOfWeek.MONDAYwhen they fall onDayOfWeek.SATURDAYorDayOfWeek.SUNDAY.This strategy is useful for Australian holidays.
-
-
Method Detail
-
values
public static ShiftingStrategy[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ShiftingStrategy c : ShiftingStrategy.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ShiftingStrategy valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum type has no constant with the specified nameNullPointerException- if the argument is null
-
shift
public abstract LocalDate shift(LocalDate localDate)
Shift the given date.- Parameters:
localDate- a non-null date- Returns:
- a non-null date
- Throws:
NullPointerException- if the given date isnull
-
unshift
public abstract LocalDate[] unshift(LocalDate localDate)
Unshift the given date.- Parameters:
localDate- a non-null date- Returns:
- a non-null date
- Throws:
NullPointerException- if the given date isnull
-
-