java.lang.Object
de.powerstat.validation.values.Month
- All Implemented Interfaces:
IValueObject
,Comparable<Month>
Month.
Not DSGVO relevant.
TODO constructor with year
TODO daysWithin() = 31, 30, 29, 28, n (Year specific for february, or october 1582)
TODO Listener
TODO Translations short/long
TODO min, max
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd months to this month.int
Compare with another object.Decrement this month.boolean
Is equal with another object.int
hashCode()
Calculate hash code.Increment this month.int
intValue()
Returns the value of this Month as an int.static Month
of
(int month) Month factory.static Month
Month factory.Returns the value of this Month as an String.Subtract months from this month.toString()
Returns the string representation of this Month.
-
Field Details
-
OVERFLOW
Overflow constant.- See Also:
-
UNDERFLOW
Underflow constant.- See Also:
-
month
private final int monthMonth.
-
-
Constructor Details
-
Month
private Month(int month) Constructor.- Parameters:
month
- Month 1-12- Throws:
IndexOutOfBoundsException
- When the month is less than 1 or greater than 12
-
-
Method Details
-
of
Month factory.- Parameters:
month
- Month 1-12- Returns:
- Month object
- Throws:
IndexOutOfBoundsException
- When the month is less than 1 or greater than 12
-
of
Month factory.- Parameters:
value
- Month 1-12 string- Returns:
- Month object
- Throws:
IndexOutOfBoundsException
- When the month is less than 1 or greater than 12
-
intValue
public int intValue()Returns the value of this Month as an int.- Returns:
- The numeric value represented by this object after conversion to type int.
-
stringValue
Returns the value of this Month as an String.- Specified by:
stringValue
in interfaceIValueObject
- Returns:
- The numeric 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 Month. The exact details of this representation are unspecified and subject to change, but the following may be regarded as typical: "Month[month=1]" -
compareTo
Compare with another object.- Specified by:
compareTo
in interfaceComparable<Month>
- Parameters:
obj
- Object to compare with- Returns:
- 0: equal; 1: greater; -1: smaller
- See Also:
-
add
Add months to this month.- Parameters:
months
- Months to add to this month- Returns:
- New month after adding the months to this month
- Throws:
ArithmeticException
- In case of an overflow
-
subtract
Subtract months from this month.- Parameters:
months
- Months to subtract from this month- Returns:
- New month after subtracting months from this month
- Throws:
ArithmeticException
- In case of an underflow
-
increment
Increment this month.- Returns:
- New month after incrementing this month
- Throws:
ArithmeticException
- In case of an overflow
-
decrement
Decrement this month.- Returns:
- New month after decrement this month
- Throws:
ArithmeticException
- In case of an overflow
-