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