Class CalendarNameProvider

java.lang.Object
java.util.spi.LocaleServiceProvider
java.util.spi.CalendarNameProvider

public abstract class CalendarNameProvider extends LocaleServiceProvider
An abstract class for service providers that provide localized string representations (display names) of Calendar field values.

Calendar Types

Calendar types are used to specify calendar systems for which the getDisplayName and getDisplayNames methods provide calendar field value names. See Calendar.getCalendarType() for details.

Calendar Fields

Calendar fields are specified with the constants defined in Calendar. The following are calendar-common fields and their values to be supported for each calendar system.

Field values
Field Value Description
Calendar.MONTH Calendar.JANUARY to Calendar.UNDECIMBER Month numbering is 0-based (e.g., 0 - January, ..., 11 - December). Some calendar systems have 13 months. Month names need to be supported in both the formatting and stand-alone forms if required by the supported locales. If there's no distinction in the two forms, the same names should be returned in both of the forms.
Calendar.DAY_OF_WEEK Calendar.SUNDAY to Calendar.SATURDAY Day-of-week numbering is 1-based starting from Sunday (i.e., 1 - Sunday, ..., 7 - Saturday).
Calendar.AM_PM Calendar.AM to Calendar.PM 0 - AM, 1 - PM

The following are calendar-specific fields and their values to be supported.

Calendar type and field values
Calendar Type Field Value Description
"gregory" Calendar.ERA 0 GregorianCalendar.BC (BCE)
1 GregorianCalendar.AD (CE)
"buddhist" Calendar.ERA 0 BC (BCE)
1 B.E. (Buddhist Era)
"japanese" Calendar.ERA 0 Seireki (Before Meiji)
1 Meiji
2 Taisho
3 Showa
4 Heisei
5 Reiwa
Calendar.YEAR 1 the first year in each era. It should be returned when a long style (Calendar.LONG_FORMAT or Calendar.LONG_STANDALONE) is specified. See also the Year representation in SimpleDateFormat.
"roc" Calendar.ERA 0 Before R.O.C.
1 R.O.C.
"islamic" Calendar.ERA 0 Before AH
1 Anno Hijrah (AH)

Calendar field value names for "gregory" must be consistent with the date-time symbols provided by DateFormatSymbolsProvider.

Time zone names are supported by TimeZoneNameProvider.

Since:
1.8
See Also:
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Sole constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract String
    getDisplayName(String calendarType, int field, int value, int style, Locale locale)
    Returns the string representation (display name) of the calendar field value in the given style and locale.
    abstract Map<String,Integer>
    getDisplayNames(String calendarType, int field, int style, Locale locale)
    Returns a Map containing all string representations (display names) of the Calendar field in the given style and locale and their corresponding field values.

    Methods declared in class LocaleServiceProvider

    getAvailableLocales, isSupportedLocale
    Modifier and Type
    Method
    Description
    abstract Locale[]
    Returns an array of all locales for which this locale service provider can provide localized objects or names.
    boolean
    Returns true if the given locale is supported by this locale service provider.

    Methods declared in class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    Modifier and Type
    Method
    Description
    protected Object
    Answers a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
    boolean
    Compares the argument to the receiver, and answers true if they represent the same object using a class specific comparison.
    protected void
    Deprecated, for removal: This API element is subject to removal in a future version.
    May cause performance issues, deadlocks and hangs.
    final Class<? extends Object>
    Answers the unique instance of java.lang.Class which represents the class of the receiver.
    int
    Answers an integer hash code for the receiver.
    final void
    Causes one thread which is waiting on the receiver to be made ready to run.
    final void
    Causes all threads which are waiting on the receiver to be made ready to run.
    Answers a string containing a concise, human-readable description of the receiver.
    final void
    Causes the thread which sent this message to be made not ready to run pending some change in the receiver (as indicated by notify or notifyAll).
    final void
    wait(long time)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.
    final void
    wait(long time, int frac)
    Causes the thread which sent this message to be made not ready to run either pending some change in the receiver (as indicated by notify or notifyAll) or the expiration of the timeout.