com.amazon.redshift.util

## Class RedshiftIntervalYearToMonth

- java.lang.Object
- - com.amazon.redshift.util.RedshiftObject
  - - com.amazon.redshift.util.RedshiftInterval
    - - com.amazon.redshift.util.RedshiftIntervalYearToMonth

All Implemented Interfaces:
  Serializable, Cloneable

    public class RedshiftIntervalYearToMonth
    extends RedshiftInterval
    implements Serializable, Cloneable

See Also:
  Serialized Form

### Field Summary

### Fields inherited from class com.amazon.redshift.util.RedshiftObject

`type, value`

### Constructor Summary

Constructors
Constructor and Description
`RedshiftIntervalYearToMonth()` required by the driver.
`RedshiftIntervalYearToMonth(int month)`
`RedshiftIntervalYearToMonth(int year, int month)`
`RedshiftIntervalYearToMonth(String value)` Initialize an interval with a given interval string representation.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `add(RedshiftIntervalYearToMonth interval)` Add this interval's value to the passed interval.
`boolean` `equals(Object obj)` Returns whether an object is equal to this one or not.
`String` `getValue()` Returns the stored interval information as a string.
`void` `setDays(int days)` Override the parent setDays method disallowing a non-zero value.
`void` `setHours(int hours)` Override the parent setHours method disallowing a non-zero value.
`void` `setMinutes(int minutes)` Override the parent setMinutes method disallowing a non-zero value.
`void` `setSeconds(double seconds)` Override the parent setSeconds method disallowing a non-zero value.
`void` `setValue(int month)` Set all values of this interval using just one specified value.
`void` `setValue(int month, long time)` Override the parent setValue method disallowing a non-zero value for time.

### Methods inherited from class com.amazon.redshift.util.RedshiftInterval

`add, add, add, clone, getDays, getHours, getMicroSeconds, getMinutes, getMonths, getSeconds, getWholeSeconds, getYears, hashCode, scale, setMonths, setValue, setValue, setYears, totalMicroseconds, totalMonths`

### Methods inherited from class com.amazon.redshift.util.RedshiftObject

`getType, setType, toString`

### Methods inherited from class java.lang.Object

`finalize, getClass, notify, notifyAll, wait, wait, wait`

### Constructor Detail

#### RedshiftIntervalYearToMonth

    public RedshiftIntervalYearToMonth()

required by the driver.

#### RedshiftIntervalYearToMonth

    public RedshiftIntervalYearToMonth(String value)
                                throws SQLException

Initialize an interval with a given interval string representation. This method simply calls the parent public method setValue().

Parameters:
  `value` - String representated interval (e.g. '3 years 2 mons').
Throws:
  `SQLException` - Is thrown if the string representation has an unknown format.
See Also:
  `RedshiftInterval.setValue(String)`

#### RedshiftIntervalYearToMonth

    public RedshiftIntervalYearToMonth(int year,
                                       int month)
                                throws SQLException

Throws:
  `SQLException`

#### RedshiftIntervalYearToMonth

    public RedshiftIntervalYearToMonth(int month)
                                throws SQLException

Throws:
  `SQLException`

### Method Detail

#### setValue

    public void setValue(int month)

Set all values of this interval using just one specified value.

Parameters:
  `month` - Total number of months (assuming 12 months in a year)

#### setValue

    public void setValue(int month,
                         long time)

Override the parent setValue method disallowing a non-zero value for time.

Overrides:
  `setValue` in class `RedshiftInterval`
Parameters:
  `month` - Total number of months (assuming 12 months in a year)
  `time` - Should be 0.

#### setDays

    public void setDays(int days)

Override the parent setDays method disallowing a non-zero value.

Overrides:
  `setDays` in class `RedshiftInterval`
Parameters:
  `days` - Should be 0.

#### setHours

    public void setHours(int hours)

Override the parent setHours method disallowing a non-zero value.

Overrides:
  `setHours` in class `RedshiftInterval`
Parameters:
  `hours` - Should be 0.

#### setMinutes

    public void setMinutes(int minutes)

Override the parent setMinutes method disallowing a non-zero value.

Overrides:
  `setMinutes` in class `RedshiftInterval`
Parameters:
  `minutes` - Should be 0.

#### setSeconds

    public void setSeconds(double seconds)

Override the parent setSeconds method disallowing a non-zero value.

Overrides:
  `setSeconds` in class `RedshiftInterval`
Parameters:
  `seconds` - Should be 0.

#### getValue

    public String getValue()

Returns the stored interval information as a string.

Overrides:
  `getValue` in class `RedshiftInterval`
Returns:
  String represented interval

#### add

    public void add(RedshiftIntervalYearToMonth 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.

Parameters:
  `interval` - intval to add

#### equals

    public boolean equals(Object obj)

Returns whether an object is equal to this one or not.

Overrides:
  `equals` in class `RedshiftInterval`
Parameters:
  `obj` - Object to compare with
Returns:
  true if the two intervals are identical