MeasureFormat instead.@Deprecated public class TimeUnitFormat extends MeasureFormat
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,
Serialized FormMeasureFormat.FormatWidth| Modifier and Type | Field and Description |
|---|---|
static int |
ABBREVIATED_NAME
Deprecated.
ICU 53 see
MeasureFormat.FormatWidth |
static int |
FULL_NAME
Deprecated.
ICU 53 see
MeasureFormat.FormatWidth |
| Constructor and Description |
|---|
TimeUnitFormat()
Deprecated.
ICU 53 use
MeasureFormat instead. |
TimeUnitFormat(java.util.Locale locale)
Deprecated.
ICU 53 use
MeasureFormat instead. |
TimeUnitFormat(java.util.Locale locale,
int style)
Deprecated.
ICU 53 use
MeasureFormat instead. |
TimeUnitFormat(ULocale locale)
Deprecated.
ICU 53 use
MeasureFormat instead. |
TimeUnitFormat(ULocale locale,
int style)
Deprecated.
ICU 53 use
MeasureFormat instead. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone()
Deprecated.
ICU 53 see
MeasureFormat |
NumberFormat |
getNumberFormat()
Deprecated.
ICU 53 see
MeasureFormat. |
TimeUnitAmount |
parseObject(java.lang.String source,
java.text.ParsePosition pos)
Deprecated.
ICU 53 see
MeasureFormat. |
TimeUnitFormat |
setLocale(java.util.Locale locale)
Deprecated.
ICU 53 see
MeasureFormat. |
TimeUnitFormat |
setLocale(ULocale locale)
Deprecated.
ICU 53 see
MeasureFormat. |
TimeUnitFormat |
setNumberFormat(NumberFormat format)
Deprecated.
ICU 53 see
MeasureFormat. |
equals, format, formatMeasurePerUnit, formatMeasures, formatMeasures, getCurrencyFormat, getCurrencyFormat, getCurrencyFormat, getInstance, getInstance, getInstance, getInstance, getLocale, getRangeFormat, getUnitDisplayName, getWidth, hashCode@Deprecated public static final int FULL_NAME
MeasureFormat.FormatWidth@Deprecated public static final int ABBREVIATED_NAME
MeasureFormat.FormatWidth@Deprecated public TimeUnitFormat()
MeasureFormat instead.@Deprecated public TimeUnitFormat(ULocale locale)
MeasureFormat instead.locale - locale of this time unit formatter.@Deprecated public TimeUnitFormat(java.util.Locale locale)
MeasureFormat instead.locale - locale of this time unit formatter.@Deprecated public TimeUnitFormat(ULocale locale, int style)
MeasureFormat instead.locale - locale of this time unit formatter.style - format style, either FULL_NAME or ABBREVIATED_NAME style.java.lang.IllegalArgumentException - if the style is not FULL_NAME or
ABBREVIATED_NAME style.@Deprecated
public TimeUnitFormat(java.util.Locale locale,
int style)
MeasureFormat instead.@Deprecated public TimeUnitFormat setLocale(ULocale locale)
MeasureFormat.locale - locale of this time unit formatter.@Deprecated public TimeUnitFormat setLocale(java.util.Locale locale)
MeasureFormat.locale - locale of this time unit formatter.@Deprecated public TimeUnitFormat setNumberFormat(NumberFormat format)
MeasureFormat.NumberFormat.getNumberInstance(ULocale).format - the number formatter.@Deprecated public NumberFormat getNumberFormat()
MeasureFormat.getNumberFormat in class MeasureFormat@Deprecated public TimeUnitAmount parseObject(java.lang.String source, java.text.ParsePosition pos)
MeasureFormat.parseObject in class MeasureFormatFormat.parseObject(java.lang.String, java.text.ParsePosition)@Deprecated public java.lang.Object clone()
MeasureFormatclone in class java.text.FormatCopyright © 2016 Unicode, Inc. and others.