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