Interface UnitPatternProvider
- All Known Subinterfaces:
RelativeTimeProvider
This SPI-interface enables the access to localized
unit patterns and is instantiated via a ServiceLoader-mechanism.
If there is no external UnitPatternProvider then Time4J will use
an internal implementation which just offers unit patterns either in
english or in scientific notation.
Note: All implementations must have a public no-arg constructor.
- Since:
- 1.2
- Author:
- Meno Hochschild
- See Also:
ServiceLoader
-
Method Summary
Modifier and TypeMethodDescriptiongetDayPattern(Locale lang, boolean future, PluralCategory category)Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of days in the past or future.getDayPattern(Locale lang, TextWidth width, PluralCategory category)Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of days.getHourPattern(Locale lang, boolean future, PluralCategory category)Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of hours in the past or future.getHourPattern(Locale lang, TextWidth width, PluralCategory category)Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of hours.getListPattern(Locale lang, TextWidth width, int size)Constructs a localized list pattern suitable for the use inMessageFormat.format(String, Object[]).getMicroPattern(Locale lang, TextWidth width, PluralCategory category)Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of microseconds.getMilliPattern(Locale lang, TextWidth width, PluralCategory category)Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of milliseconds.getMinutePattern(Locale lang, boolean future, PluralCategory category)Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of minutes in the past or future.getMinutePattern(Locale lang, TextWidth width, PluralCategory category)Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of minutes.getMonthPattern(Locale lang, boolean future, PluralCategory category)Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of months in the past or future.getMonthPattern(Locale lang, TextWidth width, PluralCategory category)Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of months.getNanoPattern(Locale lang, TextWidth width, PluralCategory category)Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of nanoseconds.getNowWord(Locale lang)Yields the localized word for the current time (now).getSecondPattern(Locale lang, boolean future, PluralCategory category)Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of seconds in the past or future.getSecondPattern(Locale lang, TextWidth width, PluralCategory category)Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of seconds.getWeekPattern(Locale lang, boolean future, PluralCategory category)Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of weeks in the past or future.getWeekPattern(Locale lang, TextWidth width, PluralCategory category)Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of weeks.getYearPattern(Locale lang, boolean future, PluralCategory category)Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of years in the past or future.getYearPattern(Locale lang, TextWidth width, PluralCategory category)Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of years.
-
Method Details
-
getYearPattern
Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of years.
- Parameters:
lang- language settingwidth- text width (ABBREVIATED as synonym for SHORT)category- plural category- Returns:
- unit pattern for years
- Throws:
MissingResourceException- if no pattern was found- Since:
- 1.2
-
getMonthPattern
Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of months.
- Parameters:
lang- language settingwidth- text width (ABBREVIATED as synonym for SHORT)category- plural category- Returns:
- unit pattern for months
- Throws:
MissingResourceException- if no pattern was found- Since:
- 1.2
-
getWeekPattern
Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of weeks.
- Parameters:
lang- language settingwidth- text width (ABBREVIATED as synonym for SHORT)category- plural category- Returns:
- unit pattern for weeks
- Throws:
MissingResourceException- if no pattern was found- Since:
- 1.2
-
getDayPattern
Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of days.
- Parameters:
lang- language settingwidth- text width (ABBREVIATED as synonym for SHORT)category- plural category- Returns:
- unit pattern for days
- Throws:
MissingResourceException- if no pattern was found- Since:
- 1.2
-
getHourPattern
Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of hours.
- Parameters:
lang- language settingwidth- text width (ABBREVIATED as synonym for SHORT)category- plural category- Returns:
- unit pattern for hours
- Throws:
MissingResourceException- if no pattern was found- Since:
- 1.2
-
getMinutePattern
Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of minutes.
- Parameters:
lang- language settingwidth- text width (ABBREVIATED as synonym for SHORT)category- plural category- Returns:
- unit pattern for minutes
- Throws:
MissingResourceException- if no pattern was found- Since:
- 1.2
-
getSecondPattern
Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of seconds.
- Parameters:
lang- language settingwidth- text width (ABBREVIATED as synonym for SHORT)category- plural category- Returns:
- unit pattern for seconds
- Throws:
MissingResourceException- if no pattern was found- Since:
- 1.2
-
getMilliPattern
Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of milliseconds.
- Parameters:
lang- language settingwidth- text width (ABBREVIATED as synonym for SHORT)category- plural category- Returns:
- unit pattern for milliseconds
- Throws:
MissingResourceException- if no pattern was found- Since:
- 1.2
-
getMicroPattern
Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of microseconds.
- Parameters:
lang- language settingwidth- text width (ABBREVIATED as synonym for SHORT)category- plural category- Returns:
- unit pattern for microseconds
- Throws:
MissingResourceException- if no pattern was found- Since:
- 1.2
-
getNanoPattern
Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of nanoseconds.
- Parameters:
lang- language settingwidth- text width (ABBREVIATED as synonym for SHORT)category- plural category- Returns:
- unit pattern for nanoseconds
- Throws:
MissingResourceException- if no pattern was found- Since:
- 1.2
-
getYearPattern
Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of years in the past or future.
- Parameters:
lang- language settingfuture- use future or past formcategory- plural category- Returns:
- unit pattern for years in the past or future
- Throws:
MissingResourceException- if no pattern was found- Since:
- 1.2
-
getMonthPattern
Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of months in the past or future.
- Parameters:
lang- language settingfuture- use future or past formcategory- plural category- Returns:
- unit pattern for months in the past or future
- Throws:
MissingResourceException- if no pattern was found- Since:
- 1.2
-
getWeekPattern
Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of weeks in the past or future.
- Parameters:
lang- language settingfuture- use future or past formcategory- plural category- Returns:
- unit pattern for weeks in the past or future
- Throws:
MissingResourceException- if no pattern was found- Since:
- 1.2
-
getDayPattern
Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of days in the past or future.
- Parameters:
lang- language settingfuture- use future or past formcategory- plural category- Returns:
- unit pattern for days in the past or future
- Throws:
MissingResourceException- if no pattern was found- Since:
- 1.2
-
getHourPattern
Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of hours in the past or future.
- Parameters:
lang- language settingfuture- use future or past formcategory- plural category- Returns:
- unit pattern for hours in the past or future
- Throws:
MissingResourceException- if no pattern was found- Since:
- 1.2
-
getMinutePattern
Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of minutes in the past or future.
- Parameters:
lang- language settingfuture- use future or past formcategory- plural category- Returns:
- unit pattern for minutes in the past or future
- Throws:
MissingResourceException- if no pattern was found- Since:
- 1.2
-
getSecondPattern
Yields the localized unit pattern with unit name and a placeholder "{0}" for the count of seconds in the past or future.
- Parameters:
lang- language settingfuture- use future or past formcategory- plural category- Returns:
- unit pattern for seconds in the past or future
- Throws:
MissingResourceException- if no pattern was found- Since:
- 1.2
-
getNowWord
Yields the localized word for the current time (now).
- Parameters:
lang- language setting- Returns:
- String
- Throws:
MissingResourceException- if not found- Since:
- 1.2
-
getListPattern
Constructs a localized list pattern suitable for the use in
MessageFormat.format(String, Object[]).- Parameters:
lang- language settingwidth- text width (ABBREVIATED as synonym for SHORT)size- count of list items- Returns:
- message format pattern with placeholders {0}, {1}, ..., {x}, ...
- Throws:
IllegalArgumentException- if size is smaller than 2MissingResourceException- if no pattern was found- Since:
- 1.2
-