java.lang.Object
de.powerstat.validation.values.GregorianDate
- All Implemented Interfaces:
IValueObject
,Comparable<GregorianDate>
Gregorian calendar date.
Not DSGVO relevant.
TODO next day
TODO previous day
TODO add x days
TODO subtract x days
TODO add days, months, years
TODO subtract days, months, years
TODO getJD
TODO getMJD
TODO getWeekday
TODO date - date = days
TODO date - date = days, months, years
TODO get WeekNr
TODO format date
TODO parse date
TODO min, max
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final GregorianCalendar
Gregorian calendar.private static final String
ISO8601 separator.private final Day
Day.private static final String
Year format.private static final String
Output format.private static final String
IT - italy constant.private final Month
Month.private final Year
Year. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
GregorianDate
(GregorianCalendar calendar, Year year, Month month, Day day) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(GregorianDate obj) Compare with another object.static GregorianDate
easter
(GregorianCalendar calendar, Year year) Calculate easter date for year.boolean
Is equal with another object.int
hashCode()
Calculate hash code.static GregorianDate
of
(GregorianCalendar calendar, Year year, Month month, Day day) GregorianDate factory.static GregorianDate
GregorianDate factory for country=IT.static GregorianDate
GregorianDate factory for country=IT.Returns the value of this GregorianDate as a string.toString()
Returns the string representation of this GregorianDate.
-
Field Details
-
FORMAT_TWODIGIT
Output format.- See Also:
-
FORMAT_FOURDIGIT
Year format.- See Also:
-
DATE_SEP
ISO8601 separator.- See Also:
-
IT
IT - italy constant.- See Also:
-
calendar
Gregorian calendar. -
year
Year. -
month
Month. -
day
Day.
-
-
Constructor Details
-
GregorianDate
Constructor.- Parameters:
calendar
- Gregorian calendaryear
- Yearmonth
- Monthday
- Day
-
-
Method Details
-
of
GregorianDate factory.- Parameters:
calendar
- Gregorian calendaryear
- Yearmonth
- Monthday
- Day- Returns:
- GregorianDate object
-
of
GregorianDate factory for country=IT.- Parameters:
year
- Yearmonth
- Monthday
- Day- Returns:
- GregorianDate object
-
of
GregorianDate factory for country=IT.- Parameters:
value
- String value of ISO8601 type yyyy-mm-dd- Returns:
- GregorianDate object
-
stringValue
Returns the value of this GregorianDate as a string.- Specified by:
stringValue
in interfaceIValueObject
- Returns:
- The text value represented by this object after conversion to type string in ISO8601 format with - as separator.
-
hashCode
public int hashCode()Calculate hash code. -
equals
Is equal with another object. -
toString
Returns the string representation of this GregorianDate. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "GregorianDate[country=IT, date=2020-07-06]" -
compareTo
Compare with another object.- Specified by:
compareTo
in interfaceComparable<GregorianDate>
- Parameters:
obj
- Object to compare with- Returns:
- 0: equal; 1: greater; -1: smaller
- See Also:
-
easter
Calculate easter date for year.- Parameters:
calendar
- Gregorian calendaryear
- Year- Returns:
- GregorianDate of easter for given year
-