Class GregorianCalendar

java.lang.Object
de.powerstat.validation.values.GregorianCalendar
All Implemented Interfaces:
IValueObject, Comparable<GregorianCalendar>

public final class GregorianCalendar extends Object implements Comparable<GregorianCalendar>, IValueObject
Gregorian calendar. Not DSGVO relevant. TODO More country reform dates
  • Field Details

  • Constructor Details

    • GregorianCalendar

      private GregorianCalendar(Country country)
      Constructor.
      Parameters:
      country - Country of gregorian calendar reform
  • Method Details

    • of

      public static GregorianCalendar of(Country country)
      GregorianClendar factory.
      Parameters:
      country - Country of gregorian calendar reform
      Returns:
      GregorianDate object
    • of

      public static GregorianCalendar of(String value)
      GregorianClendar factory.
      Parameters:
      value - Country alpha-2 code
      Returns:
      GregorianDate object
    • getCountry

      public Country getCountry()
      Get country.
      Returns:
      Country
    • stringValue

      public String stringValue()
      Returns the value of this GregorianCalendar as a string.
      Specified by:
      stringValue in interface IValueObject
      Returns:
      The text value represented by this object after conversion to type string.
    • hashCode

      public int hashCode()
      Calculate hash code.
      Overrides:
      hashCode in class Object
      Returns:
      Hash
      See Also:
    • equals

      public boolean equals(Object obj)
      Is equal with another object.
      Overrides:
      equals in class Object
      Parameters:
      obj - Object
      Returns:
      true when equal, false otherwise
      See Also:
    • toString

      public String toString()
      Returns the string representation of this GregorianCalendar. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "GregorianCalendar[]"
      Overrides:
      toString in class Object
      Returns:
      String representation of this GregorianCalendar
      See Also:
    • compareTo

      public int compareTo(GregorianCalendar obj)
      Compare with another object.
      Specified by:
      compareTo in interface Comparable<GregorianCalendar>
      Parameters:
      obj - Object to compare with
      Returns:
      0: equal; 1: greater; -1: smaller
      See Also:
    • isLeapYear

      public boolean isLeapYear(Year year)
      Is leap year.
      Parameters:
      year - Year
      Returns:
      true: leap year, false otherwise
    • daysInMonth

      public int daysInMonth(Year year, Month month)
      Days in month.
      Parameters:
      year - Year
      month - Month (1-12)
      Returns:
      Days in month (15,17,18,19,21, 28-31)