Package com.atlassian.jira.datetime
Class DateTimeFormatterFactoryImpl
java.lang.Object
com.atlassian.jira.datetime.DateTimeFormatterFactoryImpl
- All Implemented Interfaces:
DateTimeFormatterFactory
This class is responsible for providing DateTimeFormatter instances to JIRA and plugin code.
- Since:
- v4.4
-
Constructor Summary
ConstructorsConstructorDescriptionDateTimeFormatterFactoryImpl
(TimeZoneResolver timeZoneResolver, JiraAuthenticationContext jiraAuthenticationContext, ApplicationProperties applicationProperties, I18nHelper.BeanFactory i18nFactory) -
Method Summary
Modifier and TypeMethodDescriptionCreates a new DateTimeFormatter that uses the JIRA default time zone, locale, andrelative
date style.void
onClearCache
(ClearCacheEvent event) Clears this instance's cache.
-
Constructor Details
-
DateTimeFormatterFactoryImpl
public DateTimeFormatterFactoryImpl(TimeZoneResolver timeZoneResolver, JiraAuthenticationContext jiraAuthenticationContext, ApplicationProperties applicationProperties, I18nHelper.BeanFactory i18nFactory)
-
-
Method Details
-
formatter
Description copied from interface:DateTimeFormatterFactory
Creates a new DateTimeFormatter that uses the JIRA default time zone, locale, andrelative
date style. To get a "smart" formatter that automatically uses the time zone and locale of the currently logged in user, create a new formatter by callingDateTimeFormatter.forLoggedInUser()
on the formatter returned by this method, e.g.:DateTimeFormatter userFormatter = dateTimeFormatterFactory.formatter().forLoggedInUser();
Note that since JIRA 5.0 you can get aDateTimeFormatter
injected directly into your class (in that case there is no need to use this factory class).A formatter obtained in this fashion may be safely reused across requests.
- Specified by:
formatter
in interfaceDateTimeFormatterFactory
- Returns:
- a new DateTimeFormatter
-
onClearCache
Clears this instance's cache.- Parameters:
event
- a ClearCacheEvent
-