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