Package org.assertj.db.type
Class TimeValue
java.lang.Object
org.assertj.db.type.TimeValue
- All Implemented Interfaces:
Comparable<TimeValue>
This class represents a time value in the database.
- Author:
- Régis Pouiller, Julien Roy
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
boolean
static TimeValue
Makes an instance of time value from aTime
.static TimeValue
Makes an instance of time value from aLocalTime
.static TimeValue
Makes an instance of time value from aCalendar
.int
getHours()
Returns the hours.int
Returns the minutes.int
Returns the nanoseconds.int
Returns the seconds.int
hashCode()
boolean
Returns if this time value is after the time value in parameter.boolean
Returns if this time value is before the time value in parameter.Moves the time with the value in parameter.static TimeValue
now()
Makes an instance of the time value corresponding to now.static TimeValue
of
(int hours, int minutes) Makes an instance of time value from a hours and minutes.static TimeValue
of
(int hours, int minutes, int seconds) Makes an instance of time value from a hours, minutes and seconds.static TimeValue
of
(int hours, int minutes, int seconds, int nanoSeconds) Makes an instance of time value from a hours, minutes, seconds and nanoseconds.static TimeValue
Makes an instance of time value from aString
inhh:mm
,hh:mm:ss
orhh:mm:ss.nnnnnnnnn
format.reverse()
Returns the reverse of the time.toString()
-
Constructor Details
-
TimeValue
public TimeValue(int hours, int minutes, int seconds, int nanoSeconds) Constructor.- Parameters:
hours
- Hours.minutes
- Minutes.seconds
- Seconds.nanoSeconds
- Nanoseconds.
-
TimeValue
public TimeValue(int hours, int minutes, int seconds) Constructor.- Parameters:
hours
- Hours.minutes
- Minutes.seconds
- Seconds.
-
TimeValue
public TimeValue(int hours, int minutes) Constructor.- Parameters:
hours
- Hours.minutes
- Minutes.
-
TimeValue
Constructor.- Parameters:
time
- Time inString
format (hh:mm
,hh:mm:ss
orhh:mm:ss.nnnnnnnnn
).- Throws:
NullPointerException
- Iftime
isnull
.ParseException
- Iftime
don't respect thehh:mm
,hh:mm:ss
orhh:mm:ss.nnnnnnnnn
format.
-
TimeValue
Constructor.- Parameters:
time
- Time.- Throws:
NullPointerException
- Iftime
isnull
.
-
TimeValue
Constructor.- Parameters:
calendar
- Calendar.- Throws:
NullPointerException
- Ifcalendar
isnull
.
-
TimeValue
Constructor.- Parameters:
localTime
- LocalTime.- Throws:
NullPointerException
- IflocalTime
isnull
.- Since:
- 2.0.0
-
-
Method Details
-
of
Makes an instance of time value from a hours, minutes, seconds and nanoseconds.- Parameters:
hours
- Hours.minutes
- Minutes.seconds
- Seconds.nanoSeconds
- Nanoseconds.- Returns:
- An instance of time value.
-
of
Makes an instance of time value from a hours, minutes and seconds.- Parameters:
hours
- Hours.minutes
- Minutes.seconds
- Seconds.- Returns:
- An instance of time value.
-
of
Makes an instance of time value from a hours and minutes.- Parameters:
hours
- Hours.minutes
- Minutes.- Returns:
- An instance of time value.
-
parse
Makes an instance of time value from aString
inhh:mm
,hh:mm:ss
orhh:mm:ss.nnnnnnnnn
format.- Parameters:
time
- Time inString
format (hh:mm
,hh:mm:ss
orhh:mm:ss.nnnnnnnnn
).- Returns:
- An instance of time value.
- Throws:
NullPointerException
- Iftime
isnull
.ParseException
- Iftime
don't respect thehh:mm
,hh:mm:ss
orhh:mm:ss.nnnnnnnnn
format.
-
from
Makes an instance of time value from aTime
.- Parameters:
time
- Time.- Returns:
- An instance of time value.
- Throws:
NullPointerException
- Iftime
isnull
.
-
from
Makes an instance of time value from aCalendar
.- Parameters:
calendar
- Calendar.- Returns:
- An instance of time value.
- Throws:
NullPointerException
- Ifcalendar
isnull
.- Since:
- 1.1.0
-
from
Makes an instance of time value from aLocalTime
.- Parameters:
localTime
- LocalTime.- Returns:
- An instance of time value.
- Throws:
NullPointerException
- IflocalTime
isnull
.- Since:
- 2.0.0
-
now
Makes an instance of the time value corresponding to now.- Returns:
- An instance of time value.
- Since:
- 1.1.0
-
getHours
public int getHours()Returns the hours.- Returns:
- The hours.
-
getMinutes
public int getMinutes()Returns the minutes.- Returns:
- The minutes.
-
getSeconds
public int getSeconds()Returns the seconds.- Returns:
- The seconds.
-
getNanoSeconds
public int getNanoSeconds()Returns the nanoseconds.- Returns:
- The nanoseconds.
-
toString
-
equals
-
hashCode
public int hashCode() -
compareTo
- Specified by:
compareTo
in interfaceComparable<TimeValue>
-
isBefore
Returns if this time value is before the time value in parameter.- Parameters:
time
- The time value to compare to.- Returns:
- If this time value is before the time value in parameter.
-
isAfter
Returns if this time value is after the time value in parameter.- Parameters:
time
- The time value to compare to.- Returns:
- If this time value is after the time value in parameter.
-
move
Moves the time with the value in parameter.- Parameters:
time
- Value to move the date.- Returns:
- The date/time moved.
-
reverse
Returns the reverse of the time.- Returns:
- The reverse.
-