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 StringAfter.private static final StringBefore.private final CountryCountry of gregorian calendar reform.private static final StringDay.private static final StringDays.private static final int[]Days per month.private static final StringMonth.Gregorian calendar reform before and after dates.private static final StringYear. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintCompare with another object.intdaysInMonth(Year year, Month month) Days in month.booleanIs equal with another object.Get country.inthashCode()Calculate hash code.booleanisLeapYear(Year year) Is leap year.static GregorianCalendarGregorianClendar factory.static GregorianCalendarGregorianClendar 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:
stringValuein 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:
compareToin 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)
-