< prev index next >

src/java.base/share/classes/java/util/spi/CalendarNameProvider.java

Print this page




  29 import java.util.Locale;
  30 import java.util.Map;
  31 
  32 /**
  33  * An abstract class for service providers that provide localized string
  34  * representations (display names) of {@code Calendar} field values.
  35  *
  36  * <p><a id="calendartypes"><b>Calendar Types</b></a>
  37  *
  38  * <p>Calendar types are used to specify calendar systems for which the {@link
  39  * #getDisplayName(String, int, int, int, Locale) getDisplayName} and {@link
  40  * #getDisplayNames(String, int, int, Locale) getDisplayNames} methods provide
  41  * calendar field value names. See {@link Calendar#getCalendarType()} for details.
  42  *
  43  * <p><b>Calendar Fields</b>
  44  *
  45  * <p>Calendar fields are specified with the constants defined in {@link
  46  * Calendar}. The following are calendar-common fields and their values to be
  47  * supported for each calendar system.
  48  *
  49  * <table style="border-bottom:1px solid" border="1" cellpadding="3" cellspacing="0" summary="Field values">


  50  *   <tr>
  51  *     <th>Field</th>
  52  *     <th>Value</th>
  53  *     <th>Description</th>
  54  *   </tr>


  55  *   <tr>
  56  *     <td valign="top">{@link Calendar#MONTH}</td>
  57  *     <td valign="top">{@link Calendar#JANUARY} to {@link Calendar#UNDECIMBER}</td>
  58  *     <td>Month numbering is 0-based (e.g., 0 - January, ..., 11 -
  59  *         December). Some calendar systems have 13 months. Month
  60  *         names need to be supported in both the formatting and
  61  *         stand-alone forms if required by the supported locales. If there's
  62  *         no distinction in the two forms, the same names should be returned
  63  *         in both of the forms.</td>
  64  *   </tr>
  65  *   <tr>
  66  *     <td valign="top">{@link Calendar#DAY_OF_WEEK}</td>
  67  *     <td valign="top">{@link Calendar#SUNDAY} to {@link Calendar#SATURDAY}</td>
  68  *     <td>Day-of-week numbering is 1-based starting from Sunday (i.e., 1 - Sunday,
  69  *         ..., 7 - Saturday).</td>
  70  *   </tr>
  71  *   <tr>
  72  *     <td valign="top">{@link Calendar#AM_PM}</td>
  73  *     <td valign="top">{@link Calendar#AM} to {@link Calendar#PM}</td>
  74  *     <td>0 - AM, 1 - PM</td>
  75  *   </tr>

  76  * </table>
  77  *
  78  * <p style="margin-top:20px">The following are calendar-specific fields and their values to be supported.
  79  *
  80  * <table style="border-bottom:1px solid" border="1" cellpadding="3" cellspacing="0" summary="Calendar type and field values">


  81  *   <tr>
  82  *     <th>Calendar Type</th>
  83  *     <th>Field</th>
  84  *     <th>Value</th>
  85  *     <th>Description</th>
  86  *   </tr>


  87  *   <tr>
  88  *     <td rowspan="2" valign="top">{@code "gregory"}</td>
  89  *     <td rowspan="2" valign="top">{@link Calendar#ERA}</td>
  90  *     <td>0</td>
  91  *     <td>{@link java.util.GregorianCalendar#BC} (BCE)</td>
  92  *   </tr>
  93  *   <tr>
  94  *     <td>1</td>
  95  *     <td>{@link java.util.GregorianCalendar#AD} (CE)</td>
  96  *   </tr>
  97  *   <tr>
  98  *     <td rowspan="2" valign="top">{@code "buddhist"}</td>
  99  *     <td rowspan="2" valign="top">{@link Calendar#ERA}</td>
 100  *     <td>0</td>
 101  *     <td>BC (BCE)</td>
 102  *   </tr>
 103  *   <tr>
 104  *     <td>1</td>
 105  *     <td>B.E. (Buddhist Era)</td>
 106  *   </tr>


 137  *   <tr>
 138  *     <td rowspan="2" valign="top">{@code "roc"}</td>
 139  *     <td rowspan="2" valign="top">{@link Calendar#ERA}</td>
 140  *     <td>0</td>
 141  *     <td>Before R.O.C.</td>
 142  *   </tr>
 143  *   <tr>
 144  *     <td>1</td>
 145  *     <td>R.O.C.</td>
 146  *   </tr>
 147  *   <tr>
 148  *     <td rowspan="2" valign="top">{@code "islamic"}</td>
 149  *     <td rowspan="2" valign="top">{@link Calendar#ERA}</td>
 150  *     <td>0</td>
 151  *     <td>Before AH</td>
 152  *   </tr>
 153  *   <tr>
 154  *     <td>1</td>
 155  *     <td>Anno Hijrah (AH)</td>
 156  *   </tr>

 157  * </table>
 158  *
 159  * <p>Calendar field value names for {@code "gregory"} must be consistent with
 160  * the date-time symbols provided by {@link java.text.spi.DateFormatSymbolsProvider}.
 161  *
 162  * <p>Time zone names are supported by {@link TimeZoneNameProvider}.
 163  *
 164  * @author Masayoshi Okutsu
 165  * @since 1.8
 166  * @see CalendarDataProvider
 167  * @see Locale#getUnicodeLocaleType(String)
 168  */
 169 public abstract class CalendarNameProvider extends LocaleServiceProvider {
 170     /**
 171      * Sole constructor. (For invocation by subclass constructors, typically
 172      * implicit.)
 173      */
 174     protected CalendarNameProvider() {
 175     }
 176 




  29 import java.util.Locale;
  30 import java.util.Map;
  31 
  32 /**
  33  * An abstract class for service providers that provide localized string
  34  * representations (display names) of {@code Calendar} field values.
  35  *
  36  * <p><a id="calendartypes"><b>Calendar Types</b></a>
  37  *
  38  * <p>Calendar types are used to specify calendar systems for which the {@link
  39  * #getDisplayName(String, int, int, int, Locale) getDisplayName} and {@link
  40  * #getDisplayNames(String, int, int, Locale) getDisplayNames} methods provide
  41  * calendar field value names. See {@link Calendar#getCalendarType()} for details.
  42  *
  43  * <p><b>Calendar Fields</b>
  44  *
  45  * <p>Calendar fields are specified with the constants defined in {@link
  46  * Calendar}. The following are calendar-common fields and their values to be
  47  * supported for each calendar system.
  48  *
  49  * <table class="plain" style="border-bottom:1px solid">
  50  * <caption style="display:none">Field values</caption>
  51  * <thead>
  52  *   <tr>
  53  *     <th>Field</th>
  54  *     <th>Value</th>
  55  *     <th>Description</th>
  56  *   </tr>
  57  * </thead>
  58  * <tbody>
  59  *   <tr>
  60  *     <td valign="top">{@link Calendar#MONTH}</td>
  61  *     <td valign="top">{@link Calendar#JANUARY} to {@link Calendar#UNDECIMBER}</td>
  62  *     <td>Month numbering is 0-based (e.g., 0 - January, ..., 11 -
  63  *         December). Some calendar systems have 13 months. Month
  64  *         names need to be supported in both the formatting and
  65  *         stand-alone forms if required by the supported locales. If there's
  66  *         no distinction in the two forms, the same names should be returned
  67  *         in both of the forms.</td>
  68  *   </tr>
  69  *   <tr>
  70  *     <td valign="top">{@link Calendar#DAY_OF_WEEK}</td>
  71  *     <td valign="top">{@link Calendar#SUNDAY} to {@link Calendar#SATURDAY}</td>
  72  *     <td>Day-of-week numbering is 1-based starting from Sunday (i.e., 1 - Sunday,
  73  *         ..., 7 - Saturday).</td>
  74  *   </tr>
  75  *   <tr>
  76  *     <td valign="top">{@link Calendar#AM_PM}</td>
  77  *     <td valign="top">{@link Calendar#AM} to {@link Calendar#PM}</td>
  78  *     <td>0 - AM, 1 - PM</td>
  79  *   </tr>
  80  * </tbody>
  81  * </table>
  82  *
  83  * <p style="margin-top:20px">The following are calendar-specific fields and their values to be supported.
  84  *
  85  * <table class="plain" style="border-bottom:1px solid">
  86  * <caption style="display:none">Calendar type and field values</caption>
  87  * <thead>
  88  *   <tr>
  89  *     <th>Calendar Type</th>
  90  *     <th>Field</th>
  91  *     <th>Value</th>
  92  *     <th>Description</th>
  93  *   </tr>
  94  * </thead>
  95  * <tbody>
  96  *   <tr>
  97  *     <td rowspan="2" valign="top">{@code "gregory"}</td>
  98  *     <td rowspan="2" valign="top">{@link Calendar#ERA}</td>
  99  *     <td>0</td>
 100  *     <td>{@link java.util.GregorianCalendar#BC} (BCE)</td>
 101  *   </tr>
 102  *   <tr>
 103  *     <td>1</td>
 104  *     <td>{@link java.util.GregorianCalendar#AD} (CE)</td>
 105  *   </tr>
 106  *   <tr>
 107  *     <td rowspan="2" valign="top">{@code "buddhist"}</td>
 108  *     <td rowspan="2" valign="top">{@link Calendar#ERA}</td>
 109  *     <td>0</td>
 110  *     <td>BC (BCE)</td>
 111  *   </tr>
 112  *   <tr>
 113  *     <td>1</td>
 114  *     <td>B.E. (Buddhist Era)</td>
 115  *   </tr>


 146  *   <tr>
 147  *     <td rowspan="2" valign="top">{@code "roc"}</td>
 148  *     <td rowspan="2" valign="top">{@link Calendar#ERA}</td>
 149  *     <td>0</td>
 150  *     <td>Before R.O.C.</td>
 151  *   </tr>
 152  *   <tr>
 153  *     <td>1</td>
 154  *     <td>R.O.C.</td>
 155  *   </tr>
 156  *   <tr>
 157  *     <td rowspan="2" valign="top">{@code "islamic"}</td>
 158  *     <td rowspan="2" valign="top">{@link Calendar#ERA}</td>
 159  *     <td>0</td>
 160  *     <td>Before AH</td>
 161  *   </tr>
 162  *   <tr>
 163  *     <td>1</td>
 164  *     <td>Anno Hijrah (AH)</td>
 165  *   </tr>
 166  * </tbody>
 167  * </table>
 168  *
 169  * <p>Calendar field value names for {@code "gregory"} must be consistent with
 170  * the date-time symbols provided by {@link java.text.spi.DateFormatSymbolsProvider}.
 171  *
 172  * <p>Time zone names are supported by {@link TimeZoneNameProvider}.
 173  *
 174  * @author Masayoshi Okutsu
 175  * @since 1.8
 176  * @see CalendarDataProvider
 177  * @see Locale#getUnicodeLocaleType(String)
 178  */
 179 public abstract class CalendarNameProvider extends LocaleServiceProvider {
 180     /**
 181      * Sole constructor. (For invocation by subclass constructors, typically
 182      * implicit.)
 183      */
 184     protected CalendarNameProvider() {
 185     }
 186 


< prev index next >