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.
This API is ICU internal only.
|
java.lang.StringBuffer |
format(java.lang.Object obj,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
Deprecated.
ICU 53 see
MeasureFormat . |
java.lang.StringBuilder |
formatMeasures(java.lang.StringBuilder appendTo,
java.text.FieldPosition fieldPosition,
Measure... measures)
Deprecated.
This API is ICU internal only.
|
NumberFormat |
getNumberFormat()
Deprecated.
This API is ICU internal only.
|
MeasureFormat.FormatWidth |
getWidth()
Deprecated.
This API is ICU internal only.
|
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, formatMeasurePerUnit, formatMeasureRange, formatMeasures, getCurrencyFormat, getCurrencyFormat, getCurrencyFormat, getInstance, getInstance, getInstance, getInstance, getLocale, getPluralFormatter, getRangeFormat, getUnitDisplayName, 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 java.lang.StringBuffer format(java.lang.Object obj, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
MeasureFormat
.format
in class MeasureFormat
obj
- must be a Collection<? extends Measure>, Measure[], or Measure object.toAppendTo
- Formatted string appended here.pos
- Identifies a field in the formatted text.Format.format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition)
@Deprecated public TimeUnitAmount parseObject(java.lang.String source, java.text.ParsePosition pos)
MeasureFormat
.parseObject
in class MeasureFormat
Format.parseObject(java.lang.String, java.text.ParsePosition)
@Deprecated public java.lang.StringBuilder formatMeasures(java.lang.StringBuilder appendTo, java.text.FieldPosition fieldPosition, Measure... measures)
MeasureFormat
formatMeasures
in class MeasureFormat
appendTo
- the formatted string appended here.fieldPosition
- Identifies a field in the formatted text.measures
- the measures to format.MeasureFormat.formatMeasures(Measure...)
@Deprecated public MeasureFormat.FormatWidth getWidth()
MeasureFormat
getWidth
in class MeasureFormat
@Deprecated public NumberFormat getNumberFormat()
MeasureFormat
getNumberFormat
in class MeasureFormat
@Deprecated public java.lang.Object clone()
clone
in class java.text.Format
Copyright © 2016 Unicode, Inc. and others.