パッケージ org.postgresql.util

クラス PGInterval

java.lang.Object
org.postgresql.util.PGobject
org.postgresql.util.PGInterval
すべての実装されたインタフェース:
Serializable, Cloneable

public class PGInterval extends PGobject implements Serializable, Cloneable
This implements a class that handles the PostgreSQL interval type.
関連項目:
  • フィールドの概要

    クラスから継承されたフィールド org.postgresql.util.PGobject

    type, value
  • コンストラクタの概要

    コンストラクタ
    コンストラクタ
    説明
    required 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.
    Initialize a interval with a given interval string representation.
  • メソッドの概要

    修飾子とタイプ
    メソッド
    説明
    void
    Rolls this interval on a given calendar.
    void
    add(Date date)
    Rolls this interval on a given date.
    void
    add(PGInterval interval)
    Add this interval's value to the passed interval.
    This must be overridden to allow the object to be cloned.
    boolean
    equals(@Nullable Object obj)
    Returns whether an object is equal to this one or not.
    int
    Returns the days represented by this interval.
    int
    Returns the hours represented by this interval.
    int
     
    int
    Returns the minutes represented by this interval.
    int
    Returns the months represented by this interval.
    double
    Returns the seconds represented by this interval.
    @Nullable String
    Returns the stored interval information as a string.
    int
     
    int
    Returns the years represented by this interval.
    int
    Returns a hashCode for this object.
    void
    scale(int factor)
    Scale this interval by an integer factor.
    void
    setDays(int days)
    Set the days of this interval to the specified value.
    void
    setHours(int hours)
    Set the hours of this interval to the specified value.
    void
    setMinutes(int minutes)
    Set the minutes of this interval to the specified value.
    void
    setMonths(int months)
    Set the months of this interval to the specified value.
    void
    setSeconds(double seconds)
    Set the seconds of this interval to the specified value.
    void
    setValue(int years, int months, int days, int hours, int minutes, double seconds)
    Set all values of this interval to the specified values.
    void
    setValue(@Nullable String value)
    Sets a interval string represented value to this instance.
    void
    setYears(int years)
    Set the years of this interval to the specified value.

    クラスから継承されたメソッド org.postgresql.util.PGobject

    equals, getType, isNull, setType, toString

    クラスから継承されたメソッド java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • コンストラクタの詳細

    • PGInterval

      public PGInterval()
      required by the driver.
    • PGInterval

      public PGInterval(String value) throws SQLException
      Initialize a interval with a given interval string representation.
      パラメータ:
      value - String representated interval (e.g. '3 years 2 mons')
      例外:
      SQLException - Is thrown if the string representation has an unknown format
      関連項目:
    • PGInterval

      public PGInterval(int years, int months, int days, int hours, int minutes, double seconds)
      Initializes all values of this interval to the specified values.
      パラメータ:
      years - years
      months - months
      days - days
      hours - hours
      minutes - minutes
      seconds - seconds
      関連項目:
  • メソッドの詳細

    • setValue

      public void setValue(@Nullable String value) throws SQLException
      Sets 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').
      オーバーライド:
      setValue クラス内 PGobject
      パラメータ:
      value - String representated interval (e.g. '3 years 2 mons')
      例外:
      SQLException - Is thrown if the string representation has an unknown format
    • setValue

      public void setValue(int years, int months, int days, int hours, int minutes, double seconds)
      Set all values of this interval to the specified values.
      パラメータ:
      years - years
      months - months
      days - days
      hours - hours
      minutes - minutes
      seconds - seconds
    • getValue

      public @Nullable String getValue()
      Returns the stored interval information as a string.
      オーバーライド:
      getValue クラス内 PGobject
      戻り値:
      String represented interval
    • getYears

      public int getYears()
      Returns the years represented by this interval.
      戻り値:
      years represented by this interval
    • setYears

      public void setYears(int years)
      Set the years of this interval to the specified value.
      パラメータ:
      years - years to set
    • getMonths

      public int getMonths()
      Returns the months represented by this interval.
      戻り値:
      months represented by this interval
    • setMonths

      public void setMonths(int months)
      Set the months of this interval to the specified value.
      パラメータ:
      months - months to set
    • getDays

      public int getDays()
      Returns the days represented by this interval.
      戻り値:
      days represented by this interval
    • setDays

      public void setDays(int days)
      Set the days of this interval to the specified value.
      パラメータ:
      days - days to set
    • getHours

      public int getHours()
      Returns the hours represented by this interval.
      戻り値:
      hours represented by this interval
    • setHours

      public void setHours(int hours)
      Set the hours of this interval to the specified value.
      パラメータ:
      hours - hours to set
    • getMinutes

      public int getMinutes()
      Returns the minutes represented by this interval.
      戻り値:
      minutes represented by this interval
    • setMinutes

      public void setMinutes(int minutes)
      Set the minutes of this interval to the specified value.
      パラメータ:
      minutes - minutes to set
    • getSeconds

      public double getSeconds()
      Returns the seconds represented by this interval.
      戻り値:
      seconds represented by this interval
    • getWholeSeconds

      public int getWholeSeconds()
    • getMicroSeconds

      public int getMicroSeconds()
    • setSeconds

      public void setSeconds(double seconds)
      Set the seconds of this interval to the specified value.
      パラメータ:
      seconds - seconds to set
    • add

      public void add(Calendar cal)
      Rolls this interval on a given calendar.
      パラメータ:
      cal - Calendar instance to add to
    • add

      public void add(Date date)
      Rolls this interval on a given date.
      パラメータ:
      date - Date instance to add to
    • add

      public void add(PGInterval interval)
      Add 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.
      パラメータ:
      interval - intval to add
    • scale

      public 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.
      パラメータ:
      factor - scale factor
    • equals

      public boolean equals(@Nullable Object obj)
      Returns whether an object is equal to this one or not.
      オーバーライド:
      equals クラス内 PGobject
      パラメータ:
      obj - Object to compare with
      戻り値:
      true if the two intervals are identical
    • hashCode

      public int hashCode()
      Returns a hashCode for this object.
      オーバーライド:
      hashCode クラス内 PGobject
      戻り値:
      hashCode
    • clone

      public Object clone() throws CloneNotSupportedException
      クラスからコピーされた説明: PGobject
      This must be overridden to allow the object to be cloned.
      オーバーライド:
      clone クラス内 PGobject
      例外:
      CloneNotSupportedException