com.ibm.icu.util
Class JapaneseCalendar

java.lang.Object
  extended by com.ibm.icu.util.Calendar
      extended by com.ibm.icu.util.GregorianCalendar
          extended by com.ibm.icu.util.JapaneseCalendar
All Implemented Interfaces:
Serializable, Cloneable

Deprecated. This is a draft API and might change in a future release of ICU.

public class JapaneseCalendar
extends GregorianCalendar

JapaneseCalendar is a subclass of GregorianCalendar that numbers years and eras based on the reigns of the Japanese emperors. The Japanese calendar is identical to the Gregorian calendar in all respects except for the year and era. The ascension of each emperor to the throne begins a new era, and the years of that era are numbered starting with the year of ascension as year 1.

Note that in the year of an imperial ascension, there are two possible sets of year and era values: that for the old era and for the new. For example, a new era began on January 7, 1989 AD. Strictly speaking, the first six days of that year were in the Showa era, e.g. "January 6, 64 Showa", while the rest of the year was in the Heisei era, e.g. "January 7, 1 Heisei". This class handles this distinction correctly when computing dates. However, in lenient mode either form of date is acceptable as input.

In modern times, eras have started on January 8, 1868 AD, Gregorian (Meiji), July 30, 1912 (Taisho), December 25, 1926 (Showa), and January 7, 1989 (Heisei). Constants for these eras, suitable for use in the ERA field, are provided in this class. Note that the number used for each era is more or less arbitrary. Currently, the era starting in 1053 AD is era #0; however this may change in the future as we add more historical data. Use the predefined constants rather than using actual, absolute numbers.

Note This API has not been promoted to @stable and instead has been left as @draft ICU 2.8. It may yet change or be removed in a future release.

Author:
Laura Werner, Alan Liu
See Also:
GregorianCalendar, Serialized Form

Field Summary
static int CURRENT_ERA
          Deprecated. This is a draft API and might change in a future release of ICU.
static int HEISEI
          Deprecated. This is a draft API and might change in a future release of ICU.
static int MEIJI
          Deprecated. This is a draft API and might change in a future release of ICU.
static int SHOWA
          Deprecated. This is a draft API and might change in a future release of ICU.
static int TAISHO
          Deprecated. This is a draft API and might change in a future release of ICU.
 
Fields inherited from class com.ibm.icu.util.GregorianCalendar
AD, BC, invertGregorian, isGregorian
 
Fields inherited from class com.ibm.icu.util.Calendar
AM, AM_PM, APRIL, AUGUST, BASE_FIELD_COUNT, DATE, DAY_OF_MONTH, DAY_OF_WEEK, DAY_OF_WEEK_IN_MONTH, DAY_OF_YEAR, DECEMBER, DOW_LOCAL, DST_OFFSET, EPOCH_JULIAN_DAY, ERA, EXTENDED_YEAR, FEBRUARY, FRIDAY, GREATEST_MINIMUM, HOUR, HOUR_OF_DAY, INTERNALLY_SET, JAN_1_1_JULIAN_DAY, JANUARY, JULIAN_DAY, JULY, JUNE, LEAST_MAXIMUM, MARCH, MAX_DATE, MAX_FIELD_COUNT, MAX_JULIAN, MAX_MILLIS, MAXIMUM, MAY, MILLISECOND, MILLISECONDS_IN_DAY, MIN_DATE, MIN_JULIAN, MIN_MILLIS, MINIMUM, MINIMUM_USER_STAMP, MINUTE, MONDAY, MONTH, NOVEMBER, OCTOBER, ONE_DAY, ONE_HOUR, ONE_MINUTE, ONE_SECOND, ONE_WEEK, PM, RESOLVE_REMAP, SATURDAY, SECOND, SEPTEMBER, SUNDAY, THURSDAY, TUESDAY, UNDECIMBER, UNSET, WEDNESDAY, WEEK_OF_MONTH, WEEK_OF_YEAR, WEEKDAY, WEEKEND, WEEKEND_CEASE, WEEKEND_ONSET, YEAR, YEAR_WOY, ZONE_OFFSET
 
Constructor Summary
JapaneseCalendar()
          Deprecated. This is a draft API and might change in a future release of ICU.
JapaneseCalendar(Date date)
          Deprecated. This is a draft API and might change in a future release of ICU.
JapaneseCalendar(int year, int month, int date)
          Deprecated. This is a draft API and might change in a future release of ICU.
JapaneseCalendar(int era, int year, int month, int date)
          Deprecated. This is a draft API and might change in a future release of ICU.
JapaneseCalendar(int year, int month, int date, int hour, int minute, int second)
          Deprecated. This is a draft API and might change in a future release of ICU.
JapaneseCalendar(Locale aLocale)
          Deprecated. This is a draft API and might change in a future release of ICU.
JapaneseCalendar(TimeZone zone)
          Deprecated. This is a draft API and might change in a future release of ICU.
JapaneseCalendar(TimeZone zone, Locale aLocale)
          Deprecated. This is a draft API and might change in a future release of ICU.
JapaneseCalendar(TimeZone zone, ULocale locale)
          Deprecated. This is a draft API and might change in a future release of ICU.
JapaneseCalendar(ULocale locale)
          Deprecated. This is a draft API and might change in a future release of ICU.
 
Method Summary
 String getType()
          Deprecated. Return the current Calendar type.
protected  void handleComputeFields(int julianDay)
          Deprecated. This is a draft API and might change in a future release of ICU.
protected  int handleGetExtendedYear()
          Deprecated. This is a draft API and might change in a future release of ICU.
protected  int handleGetLimit(int field, int limitType)
          Deprecated. This is a draft API and might change in a future release of ICU.
 
Methods inherited from class com.ibm.icu.util.GregorianCalendar
getActualMaximum, getActualMinimum, getGregorianChange, handleComputeJulianDay, handleComputeMonthStart, handleGetMonthLength, handleGetYearLength, hashCode, isEquivalentTo, isLeapYear, roll, setGregorianChange
 
Methods inherited from class com.ibm.icu.util.Calendar
add, after, before, clear, clear, clone, complete, computeFields, computeGregorianFields, computeGregorianMonthStart, computeJulianDay, computeMillisInDay, computeTime, computeZoneOffset, equals, fieldDifference, fieldName, floorDivide, floorDivide, floorDivide, floorDivide, get, getAvailableLocales, getAvailableULocales, getDateTimeFormat, getDateTimeFormat, getDayOfWeekType, getDisplayName, getDisplayName, getFieldCount, getFieldResolutionTable, getFirstDayOfWeek, getGreatestMinimum, getGregorianDayOfMonth, getGregorianDayOfYear, getGregorianMonth, getGregorianYear, getInstance, getInstance, getInstance, getInstance, getInstance, getInstance, getLeastMaximum, getLimit, getLocale, getMaximum, getMinimalDaysInFirstWeek, getMinimum, getStamp, getTime, getTimeInMillis, getTimeZone, getWeekendTransition, gregorianMonthLength, gregorianPreviousMonthLength, handleCreateFields, handleGetDateFormat, handleGetDateFormat, internalGet, internalGet, internalGetTimeInMillis, internalSet, isGregorianLeapYear, isLenient, isSet, isWeekend, isWeekend, julianDayToDayOfWeek, julianDayToMillis, millisToJulianDay, newerField, newestStamp, pinField, prepareGetActual, resolveFields, roll, set, set, set, set, setFirstDayOfWeek, setLenient, setMinimalDaysInFirstWeek, setTime, setTimeInMillis, setTimeZone, toString, validateField, validateField, validateFields, weekNumber, weekNumber
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CURRENT_ERA

public static final int CURRENT_ERA
Deprecated. This is a draft API and might change in a future release of ICU.

MEIJI

public static final int MEIJI
Deprecated. This is a draft API and might change in a future release of ICU.
Constant for the era starting on Sept. 8, 1868 AD.


TAISHO

public static final int TAISHO
Deprecated. This is a draft API and might change in a future release of ICU.
Constant for the era starting on July 30, 1912 AD.


SHOWA

public static final int SHOWA
Deprecated. This is a draft API and might change in a future release of ICU.
Constant for the era starting on Dec. 25, 1926 AD.


HEISEI

public static final int HEISEI
Deprecated. This is a draft API and might change in a future release of ICU.
Constant for the era starting on Jan. 7, 1989 AD.

Constructor Detail

JapaneseCalendar

public JapaneseCalendar()
Deprecated. This is a draft API and might change in a future release of ICU.

Constructs a default JapaneseCalendar using the current time in the default time zone with the default locale.


JapaneseCalendar

public JapaneseCalendar(TimeZone zone)
Deprecated. This is a draft API and might change in a future release of ICU.

Constructs a JapaneseCalendar based on the current time in the given time zone with the default locale.

Parameters:
zone - the given time zone.

JapaneseCalendar

public JapaneseCalendar(Locale aLocale)
Deprecated. This is a draft API and might change in a future release of ICU.

Constructs a JapaneseCalendar based on the current time in the default time zone with the given locale.

Parameters:
aLocale - the given locale.

JapaneseCalendar

public JapaneseCalendar(ULocale locale)
Deprecated. This is a draft API and might change in a future release of ICU.

Constructs a JapaneseCalendar based on the current time in the default time zone with the given locale.

Parameters:
locale - the given ulocale.

JapaneseCalendar

public JapaneseCalendar(TimeZone zone,
                        Locale aLocale)
Deprecated. This is a draft API and might change in a future release of ICU.

Constructs a JapaneseCalendar based on the current time in the given time zone with the given locale.

Parameters:
zone - the given time zone.
aLocale - the given locale.

JapaneseCalendar

public JapaneseCalendar(TimeZone zone,
                        ULocale locale)
Deprecated. This is a draft API and might change in a future release of ICU.

Constructs a JapaneseCalendar based on the current time in the given time zone with the given locale.

Parameters:
zone - the given time zone.
locale - the given ulocale.

JapaneseCalendar

public JapaneseCalendar(Date date)
Deprecated. This is a draft API and might change in a future release of ICU.

Constructs a JapaneseCalendar with the given date set in the default time zone with the default locale.

Parameters:
date - The date to which the new calendar is set.

JapaneseCalendar

public JapaneseCalendar(int era,
                        int year,
                        int month,
                        int date)
Deprecated. This is a draft API and might change in a future release of ICU.

Constructs a JapaneseCalendar with the given date set in the default time zone with the default locale.

Parameters:
era - The imperial era used to set the calendar's ERA field. Eras are numbered starting with the Tenki era, which began in 1053 AD Gregorian, as era zero. Recent eras can be specified using the constants MEIJI (which started in 1868 AD), TAISHO (1912 AD), SHOWA (1926 AD), and HEISEI (1989 AD).
year - The value used to set the calendar's YEAR field, in terms of the era.
month - The value used to set the calendar's MONTH field. The value is 0-based. e.g., 0 for January.
date - The value used to set the calendar's DATE field.

JapaneseCalendar

public JapaneseCalendar(int year,
                        int month,
                        int date)
Deprecated. This is a draft API and might change in a future release of ICU.

Constructs a JapaneseCalendar with the given date set in the default time zone with the default locale.

Parameters:
year - The value used to set the calendar's YEAR field, in the era Heisei, the most current at the time this class was last updated.
month - The value used to set the calendar's MONTH field. The value is 0-based. e.g., 0 for January.
date - The value used to set the calendar's DATE field.

JapaneseCalendar

public JapaneseCalendar(int year,
                        int month,
                        int date,
                        int hour,
                        int minute,
                        int second)
Deprecated. This is a draft API and might change in a future release of ICU.

Constructs a JapaneseCalendar with the given date and time set for the default time zone with the default locale.

Parameters:
year - The value used to set the calendar's YEAR time field, in the era Heisei, the most current at the time of this writing.
month - The value used to set the calendar's MONTH time field. The value is 0-based. e.g., 0 for January.
date - The value used to set the calendar's DATE time field.
hour - The value used to set the calendar's HOUR_OF_DAY time field.
minute - The value used to set the calendar's MINUTE time field.
second - The value used to set the calendar's SECOND time field.
Method Detail

handleGetExtendedYear

protected int handleGetExtendedYear()
Deprecated. This is a draft API and might change in a future release of ICU.

Description copied from class: Calendar
Return the extended year defined by the current fields. This will use the EXTENDED_YEAR field or the YEAR and supra-year fields (such as ERA) specific to the calendar system, depending on which set of fields is newer.

Overrides:
handleGetExtendedYear in class GregorianCalendar
Returns:
the extended year

handleComputeFields

protected void handleComputeFields(int julianDay)
Deprecated. This is a draft API and might change in a future release of ICU.

Description copied from class: GregorianCalendar
Override Calendar to compute several fields specific to the hybrid Gregorian-Julian calendar system. These are:

Overrides:
handleComputeFields in class GregorianCalendar

handleGetLimit

protected int handleGetLimit(int field,
                             int limitType)
Deprecated. This is a draft API and might change in a future release of ICU.

Override GregorianCalendar. We should really handle YEAR_WOY and EXTENDED_YEAR here too to implement the 1..5000000 range, but it's not critical.

Overrides:
handleGetLimit in class GregorianCalendar
Parameters:
field - one of the above field numbers
limitType - one of MINIMUM, GREATEST_MINIMUM, LEAST_MAXIMUM, or MAXIMUM

getType

public String getType()
Deprecated. 
Return the current Calendar type.

Overrides:
getType in class GregorianCalendar
Returns:
type of calendar (gregorian, etc.)


Copyright (c) 2004 IBM Corporation and others.