Deprecated
ICU 53 use MeasureFormat instead.
Code Sample:
// create a time unit instance.
// only SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, and YEAR are supported
TimeUnit timeUnit = TimeUnit.SECOND;
// create time unit amount instance - a combination of Number and time unit
TimeUnitAmount source = new TimeUnitAmount(2, timeUnit);
// create time unit format instance
TimeUnitFormat format = new TimeUnitFormat();
// set the locale of time unit format
format.setLocale(new ULocale("en"));
// format a time unit amount
String formatted = format.format(source);
System.out.println(formatted);
try {
// parse a string into time unit amount
TimeUnitAmount result = (TimeUnitAmount) format.parseObject(formatted);
// result should equal to source
} catch (ParseException e) {
}
TimeUnitAmount, MeasureFormat
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| public static final int | ABBREVIATED_NAME
Constant for abbreviated name style format. |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private static final String | |
| private NumberFormat | |
| public static final int | FULL_NAME
Constant for full name style format. |
| private transient boolean | |
| private ULocale | |
| private transient PluralRules | |
| private static final long | |
| private int | |
| private transient Map | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| public | TimeUnitFormat()
Deprecated
ICU 53 use
Create empty format using full name style, for example, "hours".
MeasureFormat instead.
|
| public | TimeUnitFormat(ULocale
locale of this time unit formatter. locale)
Deprecated
ICU 53 use
Create TimeUnitFormat given a ULocale, and using full name style.
MeasureFormat instead.
|
| public | TimeUnitFormat(Locale
locale of this time unit formatter. locale)
Deprecated
ICU 53 use
Create TimeUnitFormat given a Locale, and using full name style.
MeasureFormat instead.
|
| public | TimeUnitFormat(ULocale
locale of this time unit formatter. locale, int format style, either FULL_NAME or ABBREVIATED_NAME style. style)
Deprecated
ICU 53 use
Create TimeUnitFormat given a ULocale and a formatting style.
MeasureFormat instead.
|
| private | |
| public | TimeUnitFormat(Locale locale, int style)
Deprecated
ICU 53 use
Create TimeUnitFormat given a Locale and a formatting style.
MeasureFormat instead.
|
| Modifier and Type | Method and Description |
|---|---|
| public Object | clone()
Overrides java.
Deprecated
ICU 53 see
Creates and returns a copy of this object.
MeasureFormat
|
| public NumberFormat | getNumberFormat()
Overrides com.
Deprecated
ICU 53 see
Get a copy of the number format.
MeasureFormat.
|
| pack-priv NumberFormat | getNumberFormatInternal()
Overrides com. |
| pack-priv LocalizedNumberFormatter | |
| public TimeUnitAmount | parseObject(String
A source, ParsePosition String, part of which should be parsed.A pos)ParsePosition object with index and error
index information as described above.Overrides com.
Deprecated
ICU 53 see
Parse a TimeUnitAmount.
MeasureFormat.
|
| private Object | |
| private void | |
| public TimeUnitFormat | Returns: this, for chaining.locale of this time unit formatter. locale)
Deprecated
ICU 53 see
Set the locale used for formatting or parsing.
MeasureFormat.
|
| public TimeUnitFormat | Returns: this, for chaining.locale of this time unit formatter. locale)
Deprecated
ICU 53 see
Set the locale used for formatting or parsing.
MeasureFormat.
|
| public TimeUnitFormat | Returns: this, for chaining.the number formatter. format)
Deprecated
ICU 53 see
Set the format used for formatting or parsing.
MeasureFormat.
|
| private void | |
| private void | |
| private Object |
| ABBREVIATED_NAME | back to summary |
|---|---|
| public static final int ABBREVIATED_NAME
Deprecated ICU 53 see Constant for abbreviated name style format. For example, the abbreviated name for "hour" in English is "hr" or "hrs". | |
| DEFAULT_PATTERN_FOR_DAY | back to summary |
|---|---|
| private static final String DEFAULT_PATTERN_FOR_DAY | |
| DEFAULT_PATTERN_FOR_HOUR | back to summary |
|---|---|
| private static final String DEFAULT_PATTERN_FOR_HOUR | |
| DEFAULT_PATTERN_FOR_MINUTE | back to summary |
|---|---|
| private static final String DEFAULT_PATTERN_FOR_MINUTE | |
| DEFAULT_PATTERN_FOR_MONTH | back to summary |
|---|---|
| private static final String DEFAULT_PATTERN_FOR_MONTH | |
| DEFAULT_PATTERN_FOR_SECOND | back to summary |
|---|---|
| private static final String DEFAULT_PATTERN_FOR_SECOND | |
| DEFAULT_PATTERN_FOR_WEEK | back to summary |
|---|---|
| private static final String DEFAULT_PATTERN_FOR_WEEK | |
| DEFAULT_PATTERN_FOR_YEAR | back to summary |
|---|---|
| private static final String DEFAULT_PATTERN_FOR_YEAR | |
| format | back to summary |
|---|---|
| private NumberFormat format | |
| FULL_NAME | back to summary |
|---|---|
| public static final int FULL_NAME
Deprecated ICU 53 see Constant for full name style format. For example, the full name for "hour" in English is "hour" or "hours". | |
| isReady | back to summary |
|---|---|
| private transient boolean isReady | |
| locale | back to summary |
|---|---|
| private ULocale locale | |
| pluralRules | back to summary |
|---|---|
| private transient PluralRules pluralRules | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID | |
| style | back to summary |
|---|---|
| private int style | |
| timeUnitToCountToPatterns | back to summary |
|---|---|
| private transient Map<TimeUnit, Map<String, Object[]>> timeUnitToCountToPatterns | |
| TOTAL_STYLES | back to summary |
|---|---|
| private static final int TOTAL_STYLES | |
| TimeUnitFormat | back to summary |
|---|---|
| public TimeUnitFormat()
Deprecated ICU 53 use Create empty format using full name style, for example, "hours". Use setLocale and/or setFormat to modify.
| |
| TimeUnitFormat | back to summary |
|---|---|
| public TimeUnitFormat(ULocale locale)
Deprecated ICU 53 use Create TimeUnitFormat given a ULocale, and using full name style.
| |
| TimeUnitFormat | back to summary |
|---|---|
| public TimeUnitFormat(Locale locale)
Deprecated ICU 53 use Create TimeUnitFormat given a Locale, and using full name style.
| |
| TimeUnitFormat | back to summary |
|---|---|
| public TimeUnitFormat(ULocale locale, int style)
Deprecated ICU 53 use Create TimeUnitFormat given a ULocale and a formatting style.
| |
| TimeUnitFormat | back to summary |
|---|---|
| private TimeUnitFormat(ULocale locale, int style, NumberFormat numberFormat) | |
| TimeUnitFormat | back to summary |
|---|---|
| public TimeUnitFormat(Locale locale, int style)
Deprecated ICU 53 use Create TimeUnitFormat given a Locale and a formatting style.
| |
| clone | back to summary |
|---|---|
| public Object clone() Overrides java. Doc from java. Deprecated ICU 53 see Creates and returns a copy of this object.
| |
| getNumberFormat | back to summary |
|---|---|
| public NumberFormat getNumberFormat() Overrides com. Doc from com. Deprecated ICU 53 see Get a copy of the number format.
| |
| getNumberFormatInternal | back to summary |
|---|---|
| pack-priv NumberFormat getNumberFormatInternal() Overrides com. Doc from com. Get a copy of the number format without cloning. Internal method.
| |
| getNumberFormatter | back to summary |
|---|---|
| pack-priv LocalizedNumberFormatter getNumberFormatter() Overrides com.
| |
| parseObject | back to summary |
|---|---|
| public TimeUnitAmount parseObject(String source, ParsePosition pos) Overrides com. Deprecated ICU 53 see Parse a TimeUnitAmount.
| |
| readResolve | back to summary |
|---|---|
| private Object readResolve() throws ObjectStreamException | |
| searchInTree | back to summary |
|---|---|
| private void searchInTree(String resourceKey, int styl, TimeUnit timeUnit, String srcPluralCount, String searchPluralCount, Map<String, Object[]> countToPatterns) | |
| setLocale | back to summary |
|---|---|
| public TimeUnitFormat setLocale(ULocale locale)
Deprecated ICU 53 see Set the locale used for formatting or parsing.
| |
| setLocale | back to summary |
|---|---|
| public TimeUnitFormat setLocale(Locale locale)
Deprecated ICU 53 see Set the locale used for formatting or parsing.
| |
| setNumberFormat | back to summary |
|---|---|
| public TimeUnitFormat setNumberFormat(NumberFormat format)
Deprecated ICU 53 see Set the format used for formatting or parsing. Passing null is equivalent to passing
| |
| setup | back to summary |
|---|---|
| private void setup() | |
| setup | back to summary |
|---|---|
| private void setup(String resourceKey, Map<TimeUnit, Map<String, Object[]>> timeUnitToCountToPatterns, int style, Set<String> pluralKeywords) | |
| writeReplace | back to summary |
|---|---|
| private Object writeReplace() throws ObjectStreamException | |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv boolean | |
| pack-priv ULocale | |
| pack-priv Set | |
| pack-priv int | |
| pack-priv Map |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void | put(UResource.
Initially the key string of the enumeration-start resource.
Empty if the enumeration starts at the top level of the bundle.
Reuse for output values from Array and Table getters. key,Call getArray() or getTable() as appropriate.
Then reuse for output values from Array and Table getters. value,true if the bundle has no parent;
that is, its top-level table has the nofallback attribute,
or it is the root bundle of a locale tree. noFallback)Implements abstract com. |
| beenHere | back to summary |
|---|---|
| pack-priv boolean beenHere | |
| locale | back to summary |
|---|---|
| pack-priv ULocale locale | |
| pluralKeywords | back to summary |
|---|---|
| pack-priv Set<String> pluralKeywords | |
| style | back to summary |
|---|---|
| pack-priv int style | |
| timeUnitToCountToPatterns | back to summary |
|---|---|
| pack-priv Map<TimeUnit, Map<String, Object[]>> timeUnitToCountToPatterns | |
| TimeUnitFormatSetupSink | back to summary |
|---|---|
| pack-priv TimeUnitFormatSetupSink(Map<TimeUnit, Map<String, Object[]>> timeUnitToCountToPatterns, int style, Set<String> pluralKeywords, ULocale locale) | |
| put | back to summary |
|---|---|
| public void put(UResource. Implements abstract com. Doc from com. Called once for each bundle (child-parent-...-root). The value is normally an array or table resource, and implementations of this method normally iterate over the tree of resource items stored there.
| |