Package: java.time

## [Java] Class Year

- java.time.Year

-     public class Year
      extends Object

  GDK enhancements for Year.

  displayName:
    Year
  receiverFqcn:
    java.time.Year

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public int` | `getEra()` Equivalent to calling the Year.get method with a ChronoField.ERA argument.
    `` | `public int` | `getYearOfEra()` Equivalent to calling the Year.get method with a ChronoField.YEAR_OF_ERA argument.
    `` | `public YearMonth` | `leftShift(Month month)` Returns a YearMonth of this year and the provided Month.
    `` | `public LocalDate` | `leftShift(MonthDay monthDay)` Returns a LocalDate of this year on the given MonthDay.
    `` | `public Year` | `minus(long years)` Returns a Year that is `years` years before this year.
    `` | `public Year` | `next()` Returns a Year after this year.
    `` | `public static Year` | `parse(Year type, CharSequence text, String pattern)` Parse text into a Year using the provided pattern.
    `` | `public Year` | `plus(long years)` Returns a Year that is `years` years after this year.
    `` | `public Year` | `previous()` Returns a Year before this year.
    `` | `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).

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `addShutdownHook, any, any, asBoolean, asType, clamp, clamp, collect, collect, collect, dump, each, eachMatch, eachMatch, eachWithIndex, every, every, find, find, findAll, findAll, findIndexOf, findIndexOf, findIndexValues, findIndexValues, findLastIndexOf, findLastIndexOf, findResult, findResult, findResult, findResult, getAt, getMetaClass, getMetaPropertyValues, getProperties, grep, grep, hasProperty, identity, inject, inject, inject, inject, inspect, invokeMethod, is, isCase, isNotCase, iterator, metaClass, print, print, printf, printf, println, println, println, putAt, respondsTo, respondsTo, setMetaClass, sleep, sleep, split, sprintf, sprintf, stream, takeIf, tap, toString, use, use, use, with, with, withCloseable, withCloseable, withMethodClosure, withStream, withStream, withTraits`

- - ### Method Detail

    - #### public int getEra()

      Equivalent to calling the Year.get 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 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 static Year parse(Year type, CharSequence text, String pattern)

      Parse text into a Year using the provided pattern.

      throws:
        java.lang.IllegalArgumentException if the pattern is invalid
      throws:
        java.time.format.DateTimeParseException if the text cannot be parsed
      Parameters:
        `type` - placeholder variable used by Groovy categories; ignored for default static methods
        `text` - String to be parsed to create the date instance
        `pattern` - pattern used to parse the text
      Returns:
        a Year representing the parsed text
      See Also:
        DateTimeFormatter
        Year.parse
      Since:
        2.5.0

    - #### 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