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 Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
After.private static final String
Before.private final Country
Country of gregorian calendar reform.private static final String
Day.private static final String
Days.private static final int[]
Days per month.private static final String
Month.Gregorian calendar reform before and after dates.private static final String
Year. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
Compare with another object.int
daysInMonth
(Year year, Month month) Days in month.boolean
Is equal with another object.Get country.int
hashCode()
Calculate hash code.boolean
isLeapYear
(Year year) Is leap year.static GregorianCalendar
GregorianClendar factory.static GregorianCalendar
GregorianClendar factory.Returns the value of this GregorianCalendar as a string.toString()
Returns the string representation of this GregorianCalendar.
-
Field Details
-
DAYS_IN_MONTH
private static final int[] DAYS_IN_MONTHDays per month. -
REFORM_DATES
Gregorian calendar reform before and after dates. -
AFTER
After.- See Also:
-
BEFORE
Before.- See Also:
-
DAYS
Days.- See Also:
-
DAY
Day.- See Also:
-
MONTH
Month.- See Also:
-
YEAR
Year.- See Also:
-
country
Country of gregorian calendar reform.
-
-
Constructor Details
-
GregorianCalendar
Constructor.- Parameters:
country
- Country of gregorian calendar reform
-
-
Method Details
-
of
GregorianClendar factory.- Parameters:
country
- Country of gregorian calendar reform- Returns:
- GregorianDate object
-
of
GregorianClendar factory.- Parameters:
value
- Country alpha-2 code- Returns:
- GregorianDate object
-
getCountry
Get country.- Returns:
- Country
-
stringValue
Returns the value of this GregorianCalendar as a string.- Specified by:
stringValue
in interfaceIValueObject
- Returns:
- The text value represented by this object after conversion to type string.
-
hashCode
public int hashCode()Calculate hash code. -
equals
Is equal with another object. -
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[]" -
compareTo
Compare with another object.- Specified by:
compareTo
in interfaceComparable<GregorianCalendar>
- Parameters:
obj
- Object to compare with- Returns:
- 0: equal; 1: greater; -1: smaller
- See Also:
-
isLeapYear
Is leap year.- Parameters:
year
- Year- Returns:
- true: leap year, false otherwise
-
daysInMonth
Days in month.- Parameters:
year
- Yearmonth
- Month (1-12)- Returns:
- Days in month (15,17,18,19,21, 28-31)
-