Module org.jooq

Class YearToMonth

    • Constructor Detail

      • YearToMonth

        public YearToMonth()
        Create a new year-month interval.
      • YearToMonth

        public YearToMonth​(int years)
        Create a new year-month interval.
      • YearToMonth

        public YearToMonth​(int years,
                           int months)
        Create a new year-month interval.
    • Method Detail

      • valueOf

        public static YearToMonth valueOf​(String string)
        Parse a string representation of a INTERVAL YEAR TO MONTH.
        Parameters:
        string - A string representation of the form [+|-][years]-[months]
        Returns:
        The parsed YEAR TO MONTH object, or null if the string could not be parsed.
      • year

        public static YearToMonth year​(String string)
        Parse a standard SQL string representation of a INTERVAL YEAR.
        Parameters:
        string - A string representation of the form [+|-][years]
        Returns:
        The parsed YEAR object, or null if the string could not be parsed.
      • yearToMonth

        public static YearToMonth yearToMonth​(String string)
        Parse a standard SQL string representation of a INTERVAL YEAR TO MONTH.
        Parameters:
        string - A string representation of the form [+|-][years]-[months]
        Returns:
        The parsed YEAR TO MONTH object, or null if the string could not be parsed.
      • month

        public static YearToMonth month​(String string)
        Parse a standard SQL string representation of a INTERVAL MONTH.
        Parameters:
        string - A string representation of the form [+|-][months]
        Returns:
        The parsed MONTH object, or null if the string could not be parsed.
      • toDuration

        public final Duration toDuration()
        Description copied from interface: Interval
        Get a duration representation of this interval.

        There is an obvious Duration representation for DayToSecond intervals. If the interval contains YearMonth information, then the corresponding duration will use:

        • 1 year = 365.25 days
        • 1 month = 30 days

        This corresponds to PostgreSQL's EXTRACT(EPOCH FROM my_interval) behaviour.

        Specified by:
        toDuration in interface Interval
      • neg

        public final YearToMonth neg()
        Description copied from interface: Interval
        Negate the interval (change its sign)
        Specified by:
        neg in interface Interval
      • abs

        public final YearToMonth abs()
        Description copied from interface: Interval
        Get the absolute value of the interval (set its sign to positive)
        Specified by:
        abs in interface Interval
      • getYears

        public final int getYears()
      • getMonths

        public final int getMonths()
      • getSign

        public final int getSign()
        Description copied from interface: Interval
        The sign of the interval
        Specified by:
        getSign in interface Interval
        Returns:
        1 for positive or zero, -1 for negative
      • hashCode

        public final int hashCode()
        Overrides:
        hashCode in class Object
      • equals

        public final boolean equals​(Object obj)
        Overrides:
        equals in class Object