java.lang.Object
org.jooq.util.postgres.PGobject
org.jooq.util.postgres.PGInterval
- All Implemented Interfaces:
- Serializable,- Cloneable
This implements a class that handles the PostgreSQL interval type.
- See Also:
- 
Field Summary
- 
Constructor SummaryConstructorsConstructorDescriptionrequired by the driver.PGInterval(int years, int months, int days, int hours, int minutes, double seconds) Initializes all values of this interval to the specified values.PGInterval(String value) Initialize a interval with a given interval string representation.
- 
Method SummaryModifier and TypeMethodDescriptionvoidRolls this interval on a given calendar.voidRolls this interval on a given date.voidadd(PGInterval interval) Add this interval's value to the passed interval.clone()This must be overidden to allow the object to be cloned.booleanReturns whether an object is equal to this one or not.intgetDays()Returns the days represented by this interval.intgetHours()Returns the hours represented by this interval.intintReturns the minutes represented by this interval.intReturns the months represented by this interval.doubleReturns the seconds represented by this interval.getValue()Returns the stored interval information as a string.intintgetYears()Returns the years represented by this interval.inthashCode()Returns a hashCode for this object.voidscale(int factor) Scale this interval by an integer factor.voidsetDays(int days) Set the days of this interval to the specified value.voidsetHours(int hours) Set the hours of this interval to the specified value.voidsetMinutes(int minutes) Set the minutes of this interval to the specified value.voidsetMonths(int months) Set the months of this interval to the specified value.voidsetSeconds(double seconds) Set the seconds of this interval to the specified value.voidsetValue(int years, int months, int days, int hours, int minutes, double seconds) Set all values of this interval to the specified values.voidSets a interval string represented value to this instance.voidsetYears(int years) Set the years of this interval to the specified value.
- 
Constructor Details- 
PGIntervalpublic PGInterval()required by the driver.
- 
PGIntervalInitialize a interval with a given interval string representation.- Parameters:
- value- String representated interval (e.g. '3 years 2 mons')
- See Also:
 
- 
PGIntervalpublic PGInterval(int years, int months, int days, int hours, int minutes, double seconds) Initializes all values of this interval to the specified values.- Parameters:
- years- years
- months- months
- days- days
- hours- hours
- minutes- minutes
- seconds- seconds
- See Also:
 
 
- 
- 
Method Details- 
setValueSets a interval string represented value to this instance. This method only recognize the format, that Postgres returns - not all input formats are supported (e.g. '1 yr 2 m 3 s').
- 
setValuepublic void setValue(int years, int months, int days, int hours, int minutes, double seconds) Set all values of this interval to the specified values.- Parameters:
- years- years
- months- months
- days- days
- hours- hours
- minutes- minutes
- seconds- seconds
 
- 
getValueReturns the stored interval information as a string.
- 
getYearspublic int getYears()Returns the years represented by this interval.- Returns:
- years represented by this interval
 
- 
setYearspublic void setYears(int years) Set the years of this interval to the specified value.- Parameters:
- years- years to set
 
- 
getMonthspublic int getMonths()Returns the months represented by this interval.- Returns:
- months represented by this interval
 
- 
setMonthspublic void setMonths(int months) Set the months of this interval to the specified value.- Parameters:
- months- months to set
 
- 
getDayspublic int getDays()Returns the days represented by this interval.- Returns:
- days represented by this interval
 
- 
setDayspublic void setDays(int days) Set the days of this interval to the specified value.- Parameters:
- days- days to set
 
- 
getHourspublic int getHours()Returns the hours represented by this interval.- Returns:
- hours represented by this interval
 
- 
setHourspublic void setHours(int hours) Set the hours of this interval to the specified value.- Parameters:
- hours- hours to set
 
- 
getMinutespublic int getMinutes()Returns the minutes represented by this interval.- Returns:
- minutes represented by this interval
 
- 
setMinutespublic void setMinutes(int minutes) Set the minutes of this interval to the specified value.- Parameters:
- minutes- minutes to set
 
- 
getSecondspublic double getSeconds()Returns the seconds represented by this interval.- Returns:
- seconds represented by this interval
 
- 
getWholeSecondspublic int getWholeSeconds()
- 
getMicroSecondspublic int getMicroSeconds()
- 
setSecondspublic void setSeconds(double seconds) Set the seconds of this interval to the specified value.- Parameters:
- seconds- seconds to set
 
- 
addRolls this interval on a given calendar.- Parameters:
- cal- Calendar instance to add to
 
- 
addRolls this interval on a given date.- Parameters:
- date- Date instance to add to
 
- 
addAdd this interval's value to the passed interval. This is backwards to what I would expect, but this makes it match the other existing add methods.- Parameters:
- interval- intval to add
 
- 
scalepublic void scale(int factor) Scale this interval by an integer factor. The server can scale by arbitrary factors, but that would require adjusting the call signatures for all the existing methods like getDays() or providing our own justification of fractional intervals. Neither of these seem like a good idea without a strong use case.- Parameters:
- factor- scale factor
 
- 
equalsReturns whether an object is equal to this one or not.
- 
hashCodepublic int hashCode()Returns a hashCode for this object.
- 
cloneDescription copied from class:PGobjectThis must be overidden to allow the object to be cloned.- Overrides:
- clonein class- PGobject
- Throws:
- CloneNotSupportedException
 
 
-