@CalendarType(value="iso8601") public final class CalendarYear extends FixedCalendarInterval<CalendarYear> implements ThreetenAdapter, LocalizedPatternSupport
Represents a full gregorian calendar year as interval from 1st of January until end of December.
The only element which is registered by this class is:
Note: The current calendar year can be determined by an expression like:
nowInSystemTime() or in a more general way
CalendarYear current = SystemClock.inLocalView().now(CalendarYear.chronology()).
| Modifier and Type | Field and Description |
|---|---|
static ChronoElement<Integer> |
YEAR
Element with the proleptic iso-year without any era reference and
the value range
-999999999 until 999999999. |
| Modifier and Type | Method and Description |
|---|---|
CalendarMonth |
at(Month month)
Combines this year with given month to a calendar month.
|
CalendarQuarter |
at(Quarter quarter)
Combines this year with given quarter year to a calendar quarter.
|
PlainDate |
atDayOfYear(int dayOfYear)
Combines this year with given day of year to a calendar date.
|
CalendarMonth |
atMonth(int month)
Combines this year with given month to a calendar month.
|
static Chronology<CalendarYear> |
chronology()
Yields the associated chronology.
|
int |
compareTo(CalendarYear other) |
boolean |
contains(PlainDate temporal)
Queries if given time point belongs to this interval.
|
boolean |
equals(Object obj) |
static CalendarYear |
from(GregorianDate date)
Converts given gregorian date to a calendar year.
|
static CalendarYear |
from(Year year)
Converts given JSR-310-type to a calendar year.
|
Boundary<PlainDate> |
getEnd()
Yields the upper bound of this interval.
|
Boundary<PlainDate> |
getStart()
Yields the lower bound of this interval.
|
int |
getValue()
Yields the year number.
|
int |
hashCode() |
boolean |
isAfter(PlainDate temporal)
Is this interval after the given time point?
|
boolean |
isBefore(PlainDate temporal)
Is this interval before the given time point?
|
boolean |
isLeap()
Determines if this calendar year is a leap year with 366 days.
|
Iterator<PlainDate> |
iterator()
Iterates over all days of this year.
|
int |
length()
Ermittelt die Anzahl der Tage, die zu diesem Kalenderjahr gehören.
|
CalendarYear |
minus(Years<CalendarUnit> years)
Subtracts given years from this year.
|
static CalendarYear |
nowInSystemTime()
Obtains the current calendar year in system time.
|
static CalendarYear |
of(int year)
Creates a new instance based on given gregorian calendar year.
|
CalendarYear |
plus(Years<CalendarUnit> years)
Adds given years to this year.
|
static Chronology<Year> |
threeten()
Obtains a bridge chronology for the type
java.time.Year. |
String |
toString()
Outputs this year number as a String in CLDR-format "uuuu".
|
Year |
toTemporalAccessor() |
abuts, contains, isBefore, isEmpty, isFinite, isSimultaneous, streamDaily, toFlexInterval, withValuecontains, get, get, getInt, getMaximum, getMinimum, getRegisteredElements, getTimezone, hasTimezone, isValid, isValid, isValid, matches, with, with, with, withget, getLong, isSupported, query, rangeintersects, isAfterforEach, spliterator@FormattableElement(format="u") public static final ChronoElement<Integer> YEAR
Element with the proleptic iso-year without any era reference and
the value range -999999999 until 999999999.
The term "proleptic" means that the rules of the gregorian
calendar and the associated way of year counting is applied backward
even before the introduction of gregorian calendar. The year 0
is permitted - and negative years, too. For historic year numbers,
this mathematical extrapolation is not recommended and usually
wrong.
Format pattern symbol (for CLDR standard) can be either "u" or "y". Format example for Japanese:
ChronoFormatter<CalendarYear> f =
ChronoFormatter.ofStyle(DisplayMode.FULL, Locale.JAPANESE, CalendarYear.chronology());
CalendarYear cyear = CalendarYear.of(2016);
System.out.println(f.format(cyear)); // 2016年
public static CalendarYear of(int year)
Creates a new instance based on given gregorian calendar year.
year - gregorian year within range -999,999,999 / +999,999,999IllegalArgumentException - if given argument is out of rangepublic static CalendarYear nowInSystemTime()
Obtains the current calendar year in system time.
Convenient short-cut for: SystemClock.inLocalView().now(CalendarYear.chronology()).
SystemClock.inLocalView(),
ZonalClock.now(net.time4j.engine.Chronology)public CalendarQuarter at(Quarter quarter)
Combines this year with given quarter year to a calendar quarter.
quarter - quarter yearpublic CalendarMonth at(Month month)
Combines this year with given month to a calendar month.
month - gregorian monthpublic CalendarMonth atMonth(int month)
Combines this year with given month to a calendar month.
month - gregorian month in range 1-12IllegalArgumentException - if the month is out of rangepublic PlainDate atDayOfYear(int dayOfYear)
Combines this year with given day of year to a calendar date.
dayOfYear - day of year in range 1-365/366IllegalArgumentException - if the day-of-year is out of rangepublic int getValue()
Yields the year number.
public Boundary<PlainDate> getStart()
ChronoIntervalYields the lower bound of this interval.
getStart in interface ChronoInterval<PlainDate>public Boundary<PlainDate> getEnd()
ChronoIntervalYields the upper bound of this interval.
getEnd in interface ChronoInterval<PlainDate>public boolean contains(PlainDate temporal)
ChronoIntervalQueries if given time point belongs to this interval.
contains in interface ChronoInterval<PlainDate>temporal - time point to be queriedtrue if given time point belongs to this interval else falsepublic boolean isAfter(PlainDate temporal)
ChronoIntervalIs this interval after the given time point?
isAfter in interface ChronoInterval<PlainDate>temporal - reference time pointtrue if this interval is after given time point else falsepublic boolean isBefore(PlainDate temporal)
ChronoIntervalIs this interval before the given time point?
isBefore in interface ChronoInterval<PlainDate>temporal - reference time pointtrue if this interval is before given time point else falsepublic boolean isLeap()
Determines if this calendar year is a leap year with 366 days.
true if it is a leap year else falseGregorianMath.isLeapYear(int)public int length()
Ermittelt die Anzahl der Tage, die zu diesem Kalenderjahr gehören.
isLeap()public static CalendarYear from(GregorianDate date)
Converts given gregorian date to a calendar year.
date - gregorian calendar date (for example PlainDateIllegalArgumentException - if given date is invalidpublic static CalendarYear from(Year year)
Converts given JSR-310-type to a calendar year.
year - Threeten-equivalent of this instancetoTemporalAccessor()public CalendarYear plus(Years<CalendarUnit> years)
Adds given years to this year.
years - the count of years to be addedpublic CalendarYear minus(Years<CalendarUnit> years)
Subtracts given years from this year.
years - the count of years to be subtractedpublic int compareTo(CalendarYear other)
compareTo in interface Comparable<CalendarYear>public String toString()
Outputs this year number as a String in CLDR-format "uuuu".
public Year toTemporalAccessor()
toTemporalAccessor in interface ThreetenAdapterpublic static Chronology<CalendarYear> chronology()
Yields the associated chronology.
public static Chronology<Year> threeten()
Obtains a bridge chronology for the type java.time.Year.
java.time.Yearchronology()Copyright © 2014–2018. All rights reserved.