Year (Groovy JDK enhancements)

Package: java.time

## Class Year

- - ### Methods Summary

    Methods
    Return type | Name and parameters
    --- | ---
    `int` | `getEra()` Equivalent to calling the Year#get(java.time.temporal.TemporalField) method with a ChronoField#ERA argument.
    `int` | `getYearOfEra()` Equivalent to calling the Year#get(java.time.temporal.TemporalField) method with a ChronoField#YEAR_OF_ERA argument.
    `YearMonth` | `leftShift(Month month)` Returns a YearMonth of this year and the provided Month.
    `LocalDate` | `leftShift(MonthDay monthDay)` Returns a LocalDate of this year on the given MonthDay.
    `Year` | `minus(long years)` Returns a Year that is `years` years before this year.
    `Year` | `next()` Returns a Year after this year.
    `Year` | `parse(CharSequence text, String pattern)` Parse text into a Year using the provided pattern.
    `Year` | `plus(long years)` Returns a Year that is `years` years after this year.
    `Year` | `previous()` Returns a Year before this year.
    `Period` | `rightShift(Year year)` Returns a Period between the first day of this year (inclusive) and the first day of the provided Year (exclusive).

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

    `addShutdownHook`, `any`, `any`, `asBoolean`, `asType`, `average`, `collect`, `collect`, `collect`, `contains`, `count`, `dump`, `each`, `eachWithIndex`, `equals`, `every`, `every`, `find`, `find`, `findAll`, `findAll`, `findIndexOf`, `findIndexOf`, `findIndexValues`, `findIndexValues`, `findLastIndexOf`, `findLastIndexOf`, `findResult`, `findResult`, `flatten`, `getAt`, `getMetaClass`, `getMetaPropertyValues`, `getProperties`, `grep`, `grep`, `groupBy`, `groupBy`, `hasProperty`, `identity`, `inject`, `inject`, `inspect`, `invokeMethod`, `is`, `isCase`, `iterator`, `join`, `metaClass`, `print`, `print`, `printf`, `printf`, `println`, `println`, `println`, `putAt`, `respondsTo`, `respondsTo`, `setMetaClass`, `size`, `split`, `sprintf`, `sprintf`, `stream`, `sum`, `sum`, `tap`, `toArrayString`, `toSpreadMap`, `toString`, `use`, `use`, `use`, `with`, `with`, `withTraits`

  - #### Methods inherited from interface java.lang.Comparable

    `numberAwareCompareTo`

  - #### Methods inherited from interface java.time.temporal.Temporal

    `downto`, `downto`, `rightShift`, `upto`, `upto`

  - #### Methods inherited from interface java.time.temporal.TemporalAccessor

    `getAt`

- - ### Methods Detail

    - #### public int getEra()

      Equivalent to calling the Year#get(java.time.temporal.TemporalField) method with a ChronoField#ERA argument.

      Returns the era of the year, which is currently either 0 (BC) or 1 (AD).

      Returns:
        an int representing the era
      Since:
        2.5.0

    - #### public int getYearOfEra()

      Equivalent to calling the Year#get(java.time.temporal.TemporalField) method with a ChronoField#YEAR_OF_ERA argument.

      Since Year=0 represents 1 BC, the yearOfEra value of Year=0 is 1, Year=-1 is 2, and so on.

      Returns:
        the year value of the era
      Since:
        2.5.0

    - #### public YearMonth leftShift(Month month)

      Returns a YearMonth of this year and the provided Month.

      Parameters:
        `month` - a Month
      Returns:
        a YearMonth
      Since:
        2.5.0

    - #### public LocalDate leftShift(MonthDay monthDay)

      Returns a LocalDate of this year on the given MonthDay.

      Parameters:
        `monthDay` - a MonthDay
      Returns:
        a LocalDate
      Since:
        2.5.0

    - #### public Year minus(long years)

      Returns a Year that is `years` years before this year.

      Parameters:
        `years` - the number of years to subtract
      Returns:
        a Year
      Since:
        2.5.0

    - #### public Year next()

      Returns a Year after this year.

      Returns:
        the next Year
      Since:
        2.5.0

    - #### public Year parse(CharSequence text, String pattern)

      Parse text into a Year using the provided pattern.

      Parameters:
        `text` - String to be parsed to create the date instance
        `pattern` - pattern used to parse the text
      Returns:
        a Year representing the parsed text
      Since:
        2.5.0
      See Also:
        DateTimeFormatter
        Year#parse(java.lang.CharSequence, java.time.format.DateTimeFormatter)

    - #### public Year plus(long years)

      Returns a Year that is `years` years after this year.

      Parameters:
        `years` - the number of years to add
      Returns:
        a Year
      Since:
        2.5.0

    - #### public Year previous()

      Returns a Year before this year.

      Returns:
        the previous Year
      Since:
        2.5.0

    - #### public Period rightShift(Year year)

      Returns a Period between the first day of this year (inclusive) and the first day of the provided Year (exclusive).

      Parameters:
        `year` - another Year
      Returns:
        a Period between the Years
      Since:
        2.5.0