Interface RelativeTimeProvider
- All Superinterfaces:
UnitPatternProvider
This SPI-interface enables the access to localized
unit patterns and is instantiated via a ServiceLoader
-mechanism.
If there is no external RelativeTimeProvider
then Time4J will use
an internal implementation which just offers unit patterns either in
english or in scientific notation.
Note: This interface enhances the standard UnitPatternProvider
by
new methods for short/abbreviated relative times and extra words for
"yesterday-today-tomorrow".
Note: All implementations must have a public no-arg constructor.
- Since:
- 3.6/4.4
- Author:
- Meno Hochschild
- See Also:
ServiceLoader
-
Method Summary
Modifier and TypeMethodDescriptiongetShortDayPattern(Locale lang, boolean future, PluralCategory category)
Yields the localized unit pattern with short unit name and a placeholder "{0}" for the count of days in the past or future.getShortHourPattern(Locale lang, boolean future, PluralCategory category)
Yields the localized unit pattern with short unit name and a placeholder "{0}" for the count of hours in the past or future.getShortMinutePattern(Locale lang, boolean future, PluralCategory category)
Yields the localized unit pattern with short unit name and a placeholder "{0}" for the count of minutes in the past or future.getShortMonthPattern(Locale lang, boolean future, PluralCategory category)
Yields the localized unit pattern with short unit name and a placeholder "{0}" for the count of months in the past or future.getShortSecondPattern(Locale lang, boolean future, PluralCategory category)
Yields the localized unit pattern with short unit name and a placeholder "{0}" for the count of seconds in the past or future.getShortWeekPattern(Locale lang, boolean future, PluralCategory category)
Yields the localized unit pattern with short unit name and a placeholder "{0}" for the count of weeks in the past or future.getShortYearPattern(Locale lang, boolean future, PluralCategory category)
Yields the localized unit pattern with short unit name and a placeholder "{0}" for the count of years in the past or future.getTodayWord(Locale lang)
Yields the localized word for "today".getTomorrowWord(Locale lang)
Yields the localized word for "tomorrow".getYesterdayWord(Locale lang)
Yields the localized word for "yesterday".default String
labelForLast(Weekday weekday, Locale lang)
Yields the localized word for "last {weekday}".default String
labelForNext(Weekday weekday, Locale lang)
Yields the localized word for "next {weekday}".Methods inherited from interface net.time4j.format.UnitPatternProvider
getDayPattern, getDayPattern, getHourPattern, getHourPattern, getListPattern, getMicroPattern, getMilliPattern, getMinutePattern, getMinutePattern, getMonthPattern, getMonthPattern, getNanoPattern, getNowWord, getSecondPattern, getSecondPattern, getWeekPattern, getWeekPattern, getYearPattern, getYearPattern
-
Method Details
-
getShortYearPattern
Yields the localized unit pattern with short 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 short years in the past or future
- Throws:
MissingResourceException
- if no pattern was found- Since:
- 3.6/4.4
-
getShortMonthPattern
Yields the localized unit pattern with short 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 short months in the past or future
- Throws:
MissingResourceException
- if no pattern was found- Since:
- 3.6/4.4
-
getShortWeekPattern
Yields the localized unit pattern with short 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 short weeks in the past or future
- Throws:
MissingResourceException
- if no pattern was found- Since:
- 3.6/4.4
-
getShortDayPattern
Yields the localized unit pattern with short 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 short days in the past or future
- Throws:
MissingResourceException
- if no pattern was found- Since:
- 3.6/4.4
-
getShortHourPattern
Yields the localized unit pattern with short 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 short hours in the past or future
- Throws:
MissingResourceException
- if no pattern was found- Since:
- 3.6/4.4
-
getShortMinutePattern
Yields the localized unit pattern with short 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 short minutes in the past or future
- Throws:
MissingResourceException
- if no pattern was found- Since:
- 3.6/4.4
-
getShortSecondPattern
Yields the localized unit pattern with short 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 short seconds in the past or future
- Throws:
MissingResourceException
- if no pattern was found- Since:
- 3.6/4.4
-
getYesterdayWord
Yields the localized word for "yesterday".
- Parameters:
lang
- language setting- Returns:
- String
- Throws:
MissingResourceException
- if not found- Since:
- 3.6/4.4
-
getTodayWord
Yields the localized word for "today".
- Parameters:
lang
- language setting- Returns:
- String
- Throws:
MissingResourceException
- if not found- Since:
- 3.6/4.4
-
getTomorrowWord
Yields the localized word for "tomorrow".
- Parameters:
lang
- language setting- Returns:
- String
- Throws:
MissingResourceException
- if not found- Since:
- 3.6/4.4
-
labelForLast
Yields the localized word for "last {weekday}".
- Parameters:
weekday
- the last day of week to be queriedlang
- language setting- Returns:
- String, maybe empty
- Since:
- 5.1
-
labelForNext
Yields the localized word for "next {weekday}".
- Parameters:
weekday
- the next day of week to be queriedlang
- language setting- Returns:
- String, maybe empty
- Since:
- 5.1
-