public final class UnitPatterns extends Object
Offers localized time unit patterns for formatting of durations.
UnitPatternProvider| Modifier and Type | Method and Description |
|---|---|
String |
getDays(TextWidth width,
PluralCategory category)
Yields a pattern for days which optionally contains a placeholder
of the form "{0}" standing for the count of days.
|
String |
getDaysInFuture(PluralCategory category)
Yields a pattern for days which optionally contains a placeholder
of the form "{0}" standing for the count of days in the
future.
|
String |
getDaysInPast(PluralCategory category)
Yields a pattern for days which optionally contains a placeholder
of the form "{0}" standing for the count of days in the
past.
|
String |
getHours(TextWidth width,
PluralCategory category)
Yields a pattern for hours which optionally contains a placeholder
of the form "{0}" standing for the count of hours.
|
String |
getHoursInFuture(PluralCategory category)
Yields a pattern for hours which optionally contains a placeholder
of the form "{0}" standing for the count of hours in the
future.
|
String |
getHoursInPast(PluralCategory category)
Yields a pattern for hours which optionally contains a placeholder
of the form "{0}" standing for the count of hours in the
past.
|
String |
getListPattern(TextWidth width,
int size)
Constructs a localized list pattern suitable for the use in
MessageFormat.format(String, Object[]). |
String |
getMicros(TextWidth width,
PluralCategory category)
Yields a pattern for microseconds which optionally contains a
placeholder of the form "{0}" standing for the count of
microseconds.
|
String |
getMillis(TextWidth width,
PluralCategory category)
Yields a pattern for milliseconds which optionally contains a
placeholder of the form "{0}" standing for the count of
milliseconds.
|
String |
getMinutes(TextWidth width,
PluralCategory category)
Yields a pattern for minutes which optionally contains a placeholder
of the form "{0}" standing for the count of minutes.
|
String |
getMinutesInFuture(PluralCategory category)
Yields a pattern for minutes which optionally contains a placeholder
of the form "{0}" standing for the count of minutes in the
future.
|
String |
getMinutesInPast(PluralCategory category)
Yields a pattern for minutes which optionally contains a placeholder
of the form "{0}" standing for the count of minutes in the
past.
|
String |
getMonths(TextWidth width,
PluralCategory category)
Yields a pattern for months which optionally contains a placeholder
of the form "{0}" standing for the count of months.
|
String |
getMonthsInFuture(PluralCategory category)
Yields a pattern for months which optionally contains a placeholder
of the form "{0}" standing for the count of months in the
future.
|
String |
getMonthsInPast(PluralCategory category)
Yields a pattern for months which optionally contains a placeholder
of the form "{0}" standing for the count of months in the
past.
|
String |
getNanos(TextWidth width,
PluralCategory category)
Yields a pattern for nanoseconds which optionally contains a
placeholder of the form "{0}" standing for the count of
nanoseconds.
|
String |
getNowWord()
Yields the localized word for the current time (now).
|
String |
getSeconds(TextWidth width,
PluralCategory category)
Yields a pattern for seconds which optionally contains a placeholder
of the form "{0}" standing for the count of seconds.
|
String |
getSecondsInFuture(PluralCategory category)
Yields a pattern for seconds which optionally contains a placeholder
of the form "{0}" standing for the count of seconds in the
future.
|
String |
getSecondsInPast(PluralCategory category)
Yields a pattern for seconds which optionally contains a placeholder
of the form "{0}" standing for the count of seconds in the
past.
|
String |
getWeeks(TextWidth width,
PluralCategory category)
Yields a pattern for weeks which optionally contains a placeholder
of the form "{0}" standing for the count of weeks.
|
String |
getWeeksInFuture(PluralCategory category)
Yields a pattern for weeks which optionally contains a placeholder
of the form "{0}" standing for the count of weeks in the
future.
|
String |
getWeeksInPast(PluralCategory category)
Yields a pattern for weeks which optionally contains a placeholder
of the form "{0}" standing for the count of weeks in the
past.
|
String |
getYears(TextWidth width,
PluralCategory category)
Yields a pattern for years which optionally contains a placeholder
of the form "{0}" standing for the count of years.
|
String |
getYearsInFuture(PluralCategory category)
Yields a pattern for years which optionally contains a placeholder
of the form "{0}" standing for the count of years in the
future.
|
String |
getYearsInPast(PluralCategory category)
Yields a pattern for years which optionally contains a placeholder
of the form "{0}" standing for the count of years in the
past.
|
static UnitPatterns |
of(Locale lang)
Factory method as constructor replacement.
|
public static UnitPatterns of(Locale lang)
Factory method as constructor replacement.
lang - language settingpublic String getYears(TextWidth width, PluralCategory category)
Yields a pattern for years which optionally contains a placeholder of the form "{0}" standing for the count of years.
width - text width (ABBREVIATED as synonym for SHORT)category - plural categorypublic String getMonths(TextWidth width, PluralCategory category)
Yields a pattern for months which optionally contains a placeholder of the form "{0}" standing for the count of months.
width - text width (ABBREVIATED as synonym for SHORT)category - plural categorypublic String getWeeks(TextWidth width, PluralCategory category)
Yields a pattern for weeks which optionally contains a placeholder of the form "{0}" standing for the count of weeks.
width - text width (ABBREVIATED as synonym for SHORT)category - plural categorypublic String getDays(TextWidth width, PluralCategory category)
Yields a pattern for days which optionally contains a placeholder of the form "{0}" standing for the count of days.
width - text width (ABBREVIATED as synonym for SHORT)category - plural categorypublic String getHours(TextWidth width, PluralCategory category)
Yields a pattern for hours which optionally contains a placeholder of the form "{0}" standing for the count of hours.
width - text width (ABBREVIATED as synonym for SHORT)category - plural categorypublic String getMinutes(TextWidth width, PluralCategory category)
Yields a pattern for minutes which optionally contains a placeholder of the form "{0}" standing for the count of minutes.
width - text width (ABBREVIATED as synonym for SHORT)category - plural categorypublic String getSeconds(TextWidth width, PluralCategory category)
Yields a pattern for seconds which optionally contains a placeholder of the form "{0}" standing for the count of seconds.
width - text width (ABBREVIATED as synonym for SHORT)category - plural categorypublic String getMillis(TextWidth width, PluralCategory category)
Yields a pattern for milliseconds which optionally contains a placeholder of the form "{0}" standing for the count of milliseconds.
width - text width (ABBREVIATED as synonym for SHORT)category - plural categorypublic String getMicros(TextWidth width, PluralCategory category)
Yields a pattern for microseconds which optionally contains a placeholder of the form "{0}" standing for the count of microseconds.
width - text width (ABBREVIATED as synonym for SHORT)category - plural categorypublic String getNanos(TextWidth width, PluralCategory category)
Yields a pattern for nanoseconds which optionally contains a placeholder of the form "{0}" standing for the count of nanoseconds.
width - text width (ABBREVIATED as synonym for SHORT)category - plural categorypublic String getYearsInPast(PluralCategory category)
Yields a pattern for years which optionally contains a placeholder of the form "{0}" standing for the count of years in the past.
category - plural categorypublic String getYearsInFuture(PluralCategory category)
Yields a pattern for years which optionally contains a placeholder of the form "{0}" standing for the count of years in the future.
category - plural categorypublic String getMonthsInPast(PluralCategory category)
Yields a pattern for months which optionally contains a placeholder of the form "{0}" standing for the count of months in the past.
category - plural categorypublic String getMonthsInFuture(PluralCategory category)
Yields a pattern for months which optionally contains a placeholder of the form "{0}" standing for the count of months in the future.
category - plural categorypublic String getWeeksInPast(PluralCategory category)
Yields a pattern for weeks which optionally contains a placeholder of the form "{0}" standing for the count of weeks in the past.
category - plural categorypublic String getWeeksInFuture(PluralCategory category)
Yields a pattern for weeks which optionally contains a placeholder of the form "{0}" standing for the count of weeks in the future.
category - plural categorypublic String getDaysInPast(PluralCategory category)
Yields a pattern for days which optionally contains a placeholder of the form "{0}" standing for the count of days in the past.
category - plural categorypublic String getDaysInFuture(PluralCategory category)
Yields a pattern for days which optionally contains a placeholder of the form "{0}" standing for the count of days in the future.
category - plural categorypublic String getHoursInPast(PluralCategory category)
Yields a pattern for hours which optionally contains a placeholder of the form "{0}" standing for the count of hours in the past.
category - plural categorypublic String getHoursInFuture(PluralCategory category)
Yields a pattern for hours which optionally contains a placeholder of the form "{0}" standing for the count of hours in the future.
category - plural categorypublic String getMinutesInPast(PluralCategory category)
Yields a pattern for minutes which optionally contains a placeholder of the form "{0}" standing for the count of minutes in the past.
category - plural categorypublic String getMinutesInFuture(PluralCategory category)
Yields a pattern for minutes which optionally contains a placeholder of the form "{0}" standing for the count of minutes in the future.
category - plural categorypublic String getSecondsInPast(PluralCategory category)
Yields a pattern for seconds which optionally contains a placeholder of the form "{0}" standing for the count of seconds in the past.
category - plural categorypublic String getSecondsInFuture(PluralCategory category)
Yields a pattern for seconds which optionally contains a placeholder of the form "{0}" standing for the count of seconds in the future.
category - plural categorypublic String getNowWord()
Yields the localized word for the current time (now).
public String getListPattern(TextWidth width, int size)
Constructs a localized list pattern suitable for the use in
MessageFormat.format(String, Object[]).
width - text width (ABBREVIATED as synonym for SHORT)size - count of list itemsIllegalArgumentException - if size is smaller than 2Copyright © 2014. All rights reserved.