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 TypeMethodDescriptionintbooleanstatic TimeValueMakes an instance of time value from aTime.static TimeValueMakes an instance of time value from aLocalTime.static TimeValueMakes an instance of time value from aCalendar.intgetHours()Returns the hours.intReturns the minutes.intReturns the nanoseconds.intReturns the seconds.inthashCode()booleanReturns if this time value is after the time value in parameter.booleanReturns if this time value is before the time value in parameter.Moves the time with the value in parameter.static TimeValuenow()Makes an instance of the time value corresponding to now.static TimeValueof(int hours, int minutes) Makes an instance of time value from a hours and minutes.static TimeValueof(int hours, int minutes, int seconds) Makes an instance of time value from a hours, minutes and seconds.static TimeValueof(int hours, int minutes, int seconds, int nanoSeconds) Makes an instance of time value from a hours, minutes, seconds and nanoseconds.static TimeValueMakes an instance of time value from aStringinhh:mm,hh:mm:ssorhh:mm:ss.nnnnnnnnnformat.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 inStringformat (hh:mm,hh:mm:ssorhh:mm:ss.nnnnnnnnn).- Throws:
NullPointerException- Iftimeisnull.ParseException- Iftimedon't respect thehh:mm,hh:mm:ssorhh:mm:ss.nnnnnnnnnformat.
-
TimeValue
Constructor.- Parameters:
time- Time.- Throws:
NullPointerException- Iftimeisnull.
-
TimeValue
Constructor.- Parameters:
calendar- Calendar.- Throws:
NullPointerException- Ifcalendarisnull.
-
TimeValue
Constructor.- Parameters:
localTime- LocalTime.- Throws:
NullPointerException- IflocalTimeisnull.- 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 aStringinhh:mm,hh:mm:ssorhh:mm:ss.nnnnnnnnnformat.- Parameters:
time- Time inStringformat (hh:mm,hh:mm:ssorhh:mm:ss.nnnnnnnnn).- Returns:
- An instance of time value.
- Throws:
NullPointerException- Iftimeisnull.ParseException- Iftimedon't respect thehh:mm,hh:mm:ssorhh:mm:ss.nnnnnnnnnformat.
-
from
Makes an instance of time value from aTime.- Parameters:
time- Time.- Returns:
- An instance of time value.
- Throws:
NullPointerException- Iftimeisnull.
-
from
Makes an instance of time value from aCalendar.- Parameters:
calendar- Calendar.- Returns:
- An instance of time value.
- Throws:
NullPointerException- Ifcalendarisnull.- Since:
- 1.1.0
-
from
Makes an instance of time value from aLocalTime.- Parameters:
localTime- LocalTime.- Returns:
- An instance of time value.
- Throws:
NullPointerException- IflocalTimeisnull.- 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:
compareToin 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.
-