|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.text.Format
com.ibm.icu.text.UFormat
com.ibm.icu.text.DateFormat
com.ibm.icu.text.SimpleDateFormat
com.ibm.icu.text.ChineseDateFormat
public class ChineseDateFormat
A concrete DateFormat
for ChineseCalendar
.
This class handles a ChineseCalendar
-specific field,
ChineseCalendar.IS_LEAP_MONTH
. It also redefines the
handling of two fields, ERA
and YEAR
. The
former is displayed numerically, instead of symbolically, since it is
the numeric cycle number in ChineseCalendar
. The latter is
numeric, as before, but has no special 2-digit Y2K behavior.
With regard to ChineseCalendar.IS_LEAP_MONTH
, this
class handles parsing specially. If no string symbol is found at all,
this is taken as equivalent to an IS_LEAP_MONTH
value of
zero. This allows formats to display a special string (e.g., "*") for
leap months, but no string for normal months.
Summary of field changes vs. SimpleDateFormat
:
Symbol Meaning Presentation Example ------ ------- ------------ ------- G cycle (Number) 78 y year of cycle (1..60) (Number) 17 l is leap month (Text) 4637
ChineseCalendar
,
ChineseDateFormatSymbols
,
Serialized FormNested Class Summary | |
---|---|
static class |
ChineseDateFormat.Field
The instances of this inner class are used as attribute keys and values in AttributedCharacterIterator that ChineseDateFormat.formatToCharacterIterator() method returns. |
Field Summary |
---|
Constructor Summary | |
---|---|
ChineseDateFormat(String pattern,
Locale locale)
Construct a ChineseDateFormat from a date format pattern and locale |
|
ChineseDateFormat(String pattern,
String override,
ULocale locale)
Construct a ChineseDateFormat from a date format pattern, numbering system override and locale |
|
ChineseDateFormat(String pattern,
ULocale locale)
Construct a ChineseDateFormat from a date format pattern and locale |
Method Summary | |
---|---|
protected DateFormat.Field |
patternCharToDateFormatField(char ch)
Returns a DateFormat.Field constant associated with the specified format pattern character. |
protected void |
subFormat(StringBuffer buf,
char ch,
int count,
int beginOffset,
FieldPosition pos,
Calendar cal)
Deprecated. This API is ICU internal only. |
protected int |
subParse(String text,
int start,
char ch,
int count,
boolean obeyCount,
boolean allowNegative,
boolean[] ambiguousYear,
Calendar cal)
Protected method that converts one field of the input string into a numeric field value in cal . |
Methods inherited from class com.ibm.icu.text.UFormat |
---|
getLocale |
Methods inherited from class java.text.Format |
---|
format, parseObject |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ChineseDateFormat(String pattern, Locale locale)
pattern
- the patternlocale
- the localepublic ChineseDateFormat(String pattern, ULocale locale)
pattern
- the patternlocale
- the localepublic ChineseDateFormat(String pattern, String override, ULocale locale)
pattern
- the patternoverride
- The override string. A numbering system override string can take one of the following forms:
1). If just a numbering system name is specified, it applies to all numeric fields in the date format pattern.
2). To specify an alternate numbering system on a field by field basis, use the field letters from the pattern
followed by an = sign, followed by the numbering system name. For example, to specify that just the year
be formatted using Hebrew digits, use the override "y=hebr". Multiple overrides can be specified in a single
string by separating them with a semi-colon. For example, the override string "m=thai;y=deva" would format using
Thai digits for the month and Devanagari digits for the year.locale
- the localeMethod Detail |
---|
protected void subFormat(StringBuffer buf, char ch, int count, int beginOffset, FieldPosition pos, Calendar cal)
subFormat
in class SimpleDateFormat
protected int subParse(String text, int start, char ch, int count, boolean obeyCount, boolean allowNegative, boolean[] ambiguousYear, Calendar cal)
cal
. Returns -start (for
ParsePosition) if failed. Subclasses may override this method to
modify or add parsing capabilities.
subParse
in class SimpleDateFormat
text
- the time text to be parsed.start
- where to start parsing.ch
- the pattern character for the date field text to be parsed.count
- the count of a pattern character.obeyCount
- if true, then the next field directly abuts this one,
and we should use the count to know when to stop parsing.ambiguousYear
- return parameter; upon return, if ambiguousYear[0]
is true, then a two-digit year was parsed and may need to be readjusted.
cal
with the parsed
value.protected DateFormat.Field patternCharToDateFormatField(char ch)
patternCharToDateFormatField
in class SimpleDateFormat
ch
- The pattern character
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |