Package com.atlassian.jira.datetime
Class DateTimeFormatterFactoryStub
java.lang.Object
com.atlassian.jira.datetime.DateTimeFormatterFactoryStub
- All Implemented Interfaces:
DateTimeFormatterFactory
Stub for DateTimeFormatterFactory, useful for unit tests.
- Since:
- v4.4
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates a new DateTimeFormatter that uses the JIRA default time zone, locale, andrelative
date style.jiraLocale
(Locale locale) jiraTimeZone
(org.joda.time.DateTimeZone timeZone) relativeDates
(boolean useRelativeDates) style
(DateTimeStyle style) userLocale
(Locale locale) userTimeZone
(org.joda.time.DateTimeZone timeZone)
-
Constructor Details
-
DateTimeFormatterFactoryStub
public DateTimeFormatterFactoryStub()
-
-
Method Details
-
relativeDates
-
jiraTimeZone
-
userTimeZone
-
jiraLocale
-
userLocale
-
style
-
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
-