java.text.DateFormatSymbols Maven / Gradle / Ivy
/*
This is not an official specification document, and usage is restricted.
NOTICE
(c) 2005-2007 Sun Microsystems, Inc. All Rights Reserved.
Neither this file nor any files generated from it describe a complete
specification, and they may only be used as described below. For
example, no permission is given for you to incorporate this file, in
whole or in part, in an implementation of a Java specification.
Sun Microsystems Inc. owns the copyright in this file and it is provided
to you for informative, as opposed to normative, use. The file and any
files generated from it may be used to generate other informative
documentation, such as a unified set of documents of API signatures for
a platform that includes technologies expressed as Java APIs. The file
may also be used to produce "compilation stubs," which allow
applications to be compiled and validated for such platforms.
Any work generated from this file, such as unified javadocs or compiled
stub files, must be accompanied by this notice in its entirety.
This work corresponds to the API signatures of JSR 219: Foundation
Profile 1.1. In the event of a discrepency between this work and the
JSR 219 specification, which is available at
http://www.jcp.org/en/jsr/detail?id=219, the latter takes precedence.
*/
package java.text;
import java.util.Locale;
import java.util.ResourceBundle;
import java.io.Serializable;
import java.lang.ref.SoftReference;
import java.util.Vector;
import java.util.Enumeration;
import java.util.Hashtable;
/**
* DateFormatSymbols
is a public class for encapsulating
* localizable date-time formatting data, such as the names of the
* months, the names of the days of the week, and the time zone data.
* DateFormat
and SimpleDateFormat
both use
* DateFormatSymbols
to encapsulate this information.
*
*
* Typically you shouldn't use DateFormatSymbols
directly.
* Rather, you are encouraged to create a date-time formatter with the
* DateFormat
class's factory methods: getTimeInstance
,
* getDateInstance
, or getDateTimeInstance
.
* These methods automatically create a DateFormatSymbols
for
* the formatter so that you don't have to. After the
* formatter is created, you may modify its format pattern using the
* setPattern
method. For more information about
* creating formatters using DateFormat
's factory methods,
* see {@link DateFormat}.
*
*
* If you decide to create a date-time formatter with a specific
* format pattern for a specific locale, you can do so with:
*
*
* new SimpleDateFormat(aPattern, new DateFormatSymbols(aLocale)).
*
*
*
*
* DateFormatSymbols
objects are cloneable. When you obtain
* a DateFormatSymbols
object, feel free to modify the
* date-time formatting data. For instance, you can replace the localized
* date-time format pattern characters with the ones that you feel easy
* to remember. Or you can change the representative cities
* to your favorite ones.
*
*
* New DateFormatSymbols
subclasses may be added to support
* SimpleDateFormat
for date-time formatting for additional locales.
*
* @see DateFormat
* @see SimpleDateFormat
* @see java.util.SimpleTimeZone
* @version 1.40, 10/25/05
* @author Chen-Lieh Huang
*/
public class DateFormatSymbols implements Serializable, Cloneable
{
/**
* Era strings. For example: "AD" and "BC". An array of 2 strings,
* indexed by Calendar.BC
and Calendar.AD
.
* @serial
*/
String[] eras;
/**
* Month strings. For example: "January", "February", etc. An array
* of 13 strings (some calendars have 13 months), indexed by
* Calendar.JANUARY
, Calendar.FEBRUARY
, etc.
* @serial
*/
String[] months;
/**
* Short month strings. For example: "Jan", "Feb", etc. An array of
* 13 strings (some calendars have 13 months), indexed by
* Calendar.JANUARY
, Calendar.FEBRUARY
, etc.
*
* @serial
*/
String[] shortMonths;
/**
* Weekday strings. For example: "Sunday", "Monday", etc. An array
* of 8 strings, indexed by Calendar.SUNDAY
,
* Calendar.MONDAY
, etc.
* The element weekdays[0]
is ignored.
* @serial
*/
String[] weekdays;
/**
* Short weekday strings. For example: "Sun", "Mon", etc. An array
* of 8 strings, indexed by Calendar.SUNDAY
,
* Calendar.MONDAY
, etc.
* The element shortWeekdays[0]
is ignored.
* @serial
*/
String[] shortWeekdays;
/**
* AM and PM strings. For example: "AM" and "PM". An array of
* 2 strings, indexed by Calendar.AM
and
* Calendar.PM
.
* @serial
*/
String[] ampms;
/**
* Localized names of time zones in this locale. This is a
* two-dimensional array of strings of size n by m,
* where m is at least 5. Each of the n rows is an
* entry containing the localized names for a single TimeZone
.
* Each such row contains (with i
ranging from
* 0..n-1):
*
* zoneStrings[i][0]
- time zone ID
* zoneStrings[i][1]
- long name of zone in standard
* time
* zoneStrings[i][2]
- short name of zone in
* standard time
* zoneStrings[i][3]
- long name of zone in daylight
* savings time
* zoneStrings[i][4]
- short name of zone in daylight
* savings time
*
* The zone ID is not localized; it corresponds to the ID
* value associated with a system time zone object. All other entries
* are localized names. If a zone does not implement daylight savings
* time, the daylight savings time names are ignored.
* @see java.util.TimeZone
* @serial
*/
String[][] zoneStrings;
/**
* Localized date-time pattern characters. For example, a locale may
* wish to use 'u' rather than 'y' to represent years in its date format
* pattern strings.
* This string must be exactly 18 characters long, with the index of
* the characters described by DateFormat.ERA_FIELD
,
* DateFormat.YEAR_FIELD
, etc. Thus, if the string were
* "Xz...", then localized patterns would use 'X' for era and 'z' for year.
* @serial
*/
String localPatternChars;
/* use serialVersionUID from JDK 1.1.4 for interoperability */
static final long serialVersionUID = -5987973545549424702L;
/**
* Construct a DateFormatSymbols object by loading format data from
* resources for the default locale.
*
* @exception java.util.MissingResourceException
* if the resources for the default locale cannot be
* found or cannot be loaded.
*/
public DateFormatSymbols() { }
/**
* Construct a DateFormatSymbols object by loading format data from
* resources for the given locale.
*
* @exception java.util.MissingResourceException
* if the resources for the specified locale cannot be
* found or cannot be loaded.
*/
public DateFormatSymbols(Locale locale) { }
/**
* Gets era strings. For example: "AD" and "BC".
* @return the era strings.
*/
public String[] getEras() {
return null;
}
/**
* Sets era strings. For example: "AD" and "BC".
* @param newEras the new era strings.
*/
public void setEras(String[] newEras) { }
/**
* Gets month strings. For example: "January", "February", etc.
* @return the month strings.
*/
public String[] getMonths() {
return null;
}
/**
* Sets month strings. For example: "January", "February", etc.
* @param newMonths the new month strings.
*/
public void setMonths(String[] newMonths) { }
/**
* Gets short month strings. For example: "Jan", "Feb", etc.
* @return the short month strings.
*/
public String[] getShortMonths() {
return null;
}
/**
* Sets short month strings. For example: "Jan", "Feb", etc.
* @param newShortMonths the new short month strings.
*/
public void setShortMonths(String[] newShortMonths) { }
/**
* Gets weekday strings. For example: "Sunday", "Monday", etc.
* @return the weekday strings. Use Calendar.SUNDAY
,
* Calendar.MONDAY
, etc. to index the result array.
*/
public String[] getWeekdays() {
return null;
}
/**
* Sets weekday strings. For example: "Sunday", "Monday", etc.
* @param newWeekdays the new weekday strings. The array should
* be indexed by Calendar.SUNDAY
,
* Calendar.MONDAY
, etc.
*/
public void setWeekdays(String[] newWeekdays) { }
/**
* Gets short weekday strings. For example: "Sun", "Mon", etc.
* @return the short weekday strings. Use Calendar.SUNDAY
,
* Calendar.MONDAY
, etc. to index the result array.
*/
public String[] getShortWeekdays() {
return null;
}
/**
* Sets short weekday strings. For example: "Sun", "Mon", etc.
* @param newShortWeekdays the new short weekday strings. The array should
* be indexed by Calendar.SUNDAY
,
* Calendar.MONDAY
, etc.
*/
public void setShortWeekdays(String[] newShortWeekdays) { }
/**
* Gets ampm strings. For example: "AM" and "PM".
* @return the ampm strings.
*/
public String[] getAmPmStrings() {
return null;
}
/**
* Sets ampm strings. For example: "AM" and "PM".
* @param newAmpms the new ampm strings.
*/
public void setAmPmStrings(String[] newAmpms) { }
/**
* Gets timezone strings.
* @return the timezone strings.
*/
public String[][] getZoneStrings() {
return null;
}
/**
* Sets timezone strings.
* @param newZoneStrings the new timezone strings.
*/
public void setZoneStrings(String[][] newZoneStrings) { }
/**
* Gets localized date-time pattern characters. For example: 'u', 't', etc.
* @return the localized date-time pattern characters.
*/
public String getLocalPatternChars() {
return null;
}
/**
* Sets localized date-time pattern characters. For example: 'u', 't', etc.
* @param newLocalPatternChars the new localized date-time
* pattern characters.
*/
public void setLocalPatternChars(String newLocalPatternChars) { }
/**
* Overrides Cloneable
*/
public Object clone() {
return null;
}
/**
* Override hashCode.
* Generates a hash code for the DateFormatSymbols object.
*/
public int hashCode() {
return 0;
}
/**
* Override equals
*/
public boolean equals(Object obj) {
return false;
}
}