Package rs.baselib.util
Class RsYear
java.lang.Object
java.util.Calendar
java.util.GregorianCalendar
rs.baselib.util.RsDate
rs.baselib.util.RsYear
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Comparable<java.util.Calendar>
public class RsYear extends RsDate
A year.
- Author:
- Ralph
- See Also:
- Serialized Form
-
Nested Class Summary
-
Field Summary
Fields inherited from class java.util.Calendar
ALL_STYLES, AM, AM_PM, APRIL, areFieldsSet, AUGUST, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, DST_OFFSET, ERA, FEBRUARY, FIELD_COUNT, fields, FRIDAY, HOUR, HOUR_OF_DAY, isSet, isTimeSet, JANUARY, JULY, JUNE, LONG, LONG_FORMAT, LONG_STANDALONE, MARCH, MAY, MILLISECOND, MINUTE, MONDAY, MONTH, NARROW_FORMAT, NARROW_STANDALONE, NOVEMBER, OCTOBER, PM, SATURDAY, SECOND, SEPTEMBER, SHORT, SHORT_FORMAT, SHORT_STANDALONE, SUNDAY, THURSDAY, time, TUESDAY, UNDECIMBER, WEDNESDAY, WEEK_OF_MONTH, WEEK_OF_YEAR, YEAR, ZONE_OFFSET -
Constructor Summary
Constructors Constructor Description RsYear()Constructor.RsYear(int year)Constructor.RsYear(long timeInMillis)Constructor.RsYear(java.util.Calendar calendar)Constructor.RsYear(java.util.Date date)Constructor.RsYear(java.util.TimeZone timezone)Constructor.RsYear(java.util.TimeZone timezone, int year)Constructor.RsYear(java.util.TimeZone timezone, long timeInMillis)Constructor.RsYear(java.util.TimeZone timezone, java.util.Date date)Constructor. -
Method Summary
Modifier and Type Method Description protected voidensureBegin()Adjusts the time stamp to the start of the year.booleanequals(java.lang.Object o)RsDategetBegin()Returns the begin of this year.RsDategetEnd()Returns the end of this year.intgetIntKey()Returns the key of this year.java.lang.StringgetKey()Returns the key of this year.RsYeargetNext()Returns the next year.RsYeargetPrevious()Returns the previous year.static RsYeargetYear(int year)Returns a year object for the given key.static RsYeargetYear(java.lang.String key)Returns a year object for the given key.inthashCode()java.lang.StringtoString()Methods inherited from class java.util.GregorianCalendar
add, clone, computeFields, computeTime, from, getActualMaximum, getActualMinimum, getCalendarType, getGreatestMinimum, getGregorianChange, getLeastMaximum, getMaximum, getMinimum, getTimeZone, getWeeksInWeekYear, getWeekYear, isLeapYear, isWeekDateSupported, roll, roll, setGregorianChange, setTimeZone, setWeekDate, toZonedDateTimeMethods inherited from class java.util.Calendar
after, before, clear, clear, compareTo, complete, get, getAvailableCalendarTypes, getAvailableLocales, getDisplayName, getDisplayNames, getFirstDayOfWeek, getInstance, getInstance, getInstance, getInstance, getMinimalDaysInFirstWeek, getTime, getTimeInMillis, internalGet, isLenient, isSet, set, set, set, set, setFirstDayOfWeek, setLenient, setMinimalDaysInFirstWeek, setTime, setTimeInMillis, toInstant
-
Constructor Details
-
RsYear
public RsYear()Constructor.- Since:
- 1.2.8
-
RsYear
public RsYear(java.util.TimeZone timezone)Constructor.- Parameters:
timezone- - init with timezone
-
RsYear
public RsYear(java.util.Date date)Constructor.- Parameters:
date- - init with date
-
RsYear
public RsYear(java.util.TimeZone timezone, java.util.Date date)Constructor.- Parameters:
timezone- - init with timezonedate- - init with date
-
RsYear
public RsYear(long timeInMillis)Constructor.- Parameters:
timeInMillis- - init with timestamp
-
RsYear
public RsYear(java.util.TimeZone timezone, long timeInMillis)Constructor.- Parameters:
timezone- - init with timezonetimeInMillis- - init with timestamp
-
RsYear
public RsYear(java.util.Calendar calendar)Constructor.- Parameters:
calendar- - init with calendar time
-
RsYear
public RsYear(int year)Constructor.- Parameters:
year- - year value
-
RsYear
public RsYear(java.util.TimeZone timezone, int year)Constructor.- Parameters:
timezone- - init with timezoneyear- - year value- Since:
- 1.2.8
-
-
Method Details
-
ensureBegin
protected void ensureBegin()Adjusts the time stamp to the start of the year. -
getKey
public java.lang.String getKey()Returns the key of this year.- Returns:
- the key
-
getIntKey
public int getIntKey()Returns the key of this year.- Returns:
- the year
-
getBegin
Returns the begin of this year.- Returns:
- begin of year
-
getEnd
Returns the end of this year.- Returns:
- begin of year
-
getNext
Returns the next year.- Returns:
- next year
-
getPrevious
Returns the previous year.- Returns:
- previous year
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classjava.util.GregorianCalendar
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.util.GregorianCalendar
-
toString
public java.lang.String toString() -
getYear
Returns a year object for the given key.- Parameters:
key- key of year- Returns:
- year object
-
getYear
Returns a year object for the given key.- Parameters:
year- year number- Returns:
- year object
-