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
UFormat.SpanField
Format.Field
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(Locale locale)
Deprecated.
ICU 53 use
MeasureFormat instead. |
TimeUnitFormat(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 |
---|---|
Object |
clone()
Deprecated.
ICU 53 see
MeasureFormat |
NumberFormat |
getNumberFormat()
Deprecated.
ICU 53 see
MeasureFormat . |
TimeUnitAmount |
parseObject(String source,
ParsePosition pos)
Deprecated.
ICU 53 see
MeasureFormat . |
TimeUnitFormat |
setLocale(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
format, formatToCharacterIterator, parseObject
@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(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.IllegalArgumentException
- if the style is not FULL_NAME or
ABBREVIATED_NAME style.@Deprecated public TimeUnitFormat(Locale locale, int style)
MeasureFormat
instead.@Deprecated public TimeUnitFormat setLocale(ULocale locale)
MeasureFormat
.locale
- locale of this time unit formatter.@Deprecated public TimeUnitFormat setLocale(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(String source, ParsePosition pos)
MeasureFormat
.parseObject
in class MeasureFormat
Format.parseObject(java.lang.String, java.text.ParsePosition)
@Deprecated public Object clone()
MeasureFormat
Copyright © 2016 Unicode, Inc. and others.