Enum Class YearDefinition

java.lang.Object
java.lang.Enum<YearDefinition>
net.time4j.history.YearDefinition
All Implemented Interfaces:
Serializable, Comparable<YearDefinition>, java.lang.constant.Constable

public enum YearDefinition extends Enum<YearDefinition>

Defines different strategies how to handle the difference between the standard calendar year from first of January to end of December and historic years which follow different new year rules.

Since:
3.18/4.14
Author:
Meno Hochschild
  • Enum Constant Details

    • DUAL_DATING

      public static final YearDefinition DUAL_DATING

      Prefers the standard calendar year whose range is from first of January until end of December.

      When used in formatting context dual dating like 1602/03 will be used if and only if the historic year deviates from standard calendar year. This year definition is the default.

    • AFTER_NEW_YEAR

      public static final YearDefinition AFTER_NEW_YEAR

      Uses the displayed historic year only, even if it deviates from standard calendar year.

      If historic dates consisting of displayed year, month and day-of-month become ambivalent due to prolonged year length then the date shortly after new year will be taken. Dual dating is not used.

    • BEFORE_NEW_YEAR

      public static final YearDefinition BEFORE_NEW_YEAR

      Uses the displayed historic year only, even if it deviates from standard calendar year.

      If historic dates consisting of displayed year, month and day-of-month become ambivalent due to prolonged year length then the date shortly before next new year will be taken. Dual dating is not used.

  • Method Details

    • values

      public static YearDefinition[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static YearDefinition valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null