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