public class

DateTimeFormatterFactoryImpl

extends Object
implements DateTimeFormatterFactory
java.lang.Object
   ↳ com.atlassian.jira.datetime.DateTimeFormatterFactoryImpl

Class Overview

This class is responsible for providing DateTimeFormatter instances to JIRA and plugin code.

Summary

Public Constructors
DateTimeFormatterFactoryImpl(TimeZoneResolver timeZoneResolver, JiraAuthenticationContext jiraAuthenticationContext, ApplicationProperties applicationProperties, I18nHelper.BeanFactory i18nFactory)
Public Methods
DateTimeFormatter formatter()
Creates a new DateTimeFormatter that uses the JIRA default time zone, locale, and relative date style.
@EventListener void onClearCache(ClearCacheEvent event)
Clears this instance's cache.
[Expand]
Inherited Methods
From class java.lang.Object
From interface com.atlassian.jira.datetime.DateTimeFormatterFactory

Public Constructors

public DateTimeFormatterFactoryImpl (TimeZoneResolver timeZoneResolver, JiraAuthenticationContext jiraAuthenticationContext, ApplicationProperties applicationProperties, I18nHelper.BeanFactory i18nFactory)

Public Methods

public DateTimeFormatter formatter ()

Creates a new DateTimeFormatter that uses the JIRA default time zone, locale, and relative 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 calling DateTimeFormatter.forLoggedInUser() on the formatter returned by this method, e.g.:

     DateTimeFormatter userFormatter = dateTimeFormatterFactory.formatter().forLoggedInUser();
 
Note that since JIRA 5.0 you can get a DateTimeFormatter 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.

Returns
  • a new DateTimeFormatter

@EventListener public void onClearCache (ClearCacheEvent event)

Clears this instance's cache.

Parameters
event a ClearCacheEvent