com.atlassian.jira.datetime
Class DateTimeFormatterFactoryStub

java.lang.Object
  extended by com.atlassian.jira.datetime.DateTimeFormatterFactoryStub
All Implemented Interfaces:
DateTimeFormatterFactory

public class DateTimeFormatterFactoryStub
extends Object
implements DateTimeFormatterFactory

Stub for DateTimeFormatterFactory, useful for unit tests.

Since:
v4.4

Constructor Summary
DateTimeFormatterFactoryStub()
           
 
Method Summary
 DateTimeFormatter formatter()
          Creates a new DateTimeFormatter that uses the JIRA default time zone, locale, and relative date style.
 DateTimeFormatterFactoryStub jiraLocale(Locale locale)
           
 DateTimeFormatterFactoryStub jiraTimeZone(org.joda.time.DateTimeZone timeZone)
           
 DateTimeFormatterFactoryStub relativeDates(boolean useRelativeDates)
           
 DateTimeFormatterFactoryStub userLocale(Locale locale)
           
 DateTimeFormatterFactoryStub userTimeZone(org.joda.time.DateTimeZone timeZone)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DateTimeFormatterFactoryStub

public DateTimeFormatterFactoryStub()
Method Detail

relativeDates

public DateTimeFormatterFactoryStub relativeDates(boolean useRelativeDates)

jiraTimeZone

public DateTimeFormatterFactoryStub jiraTimeZone(org.joda.time.DateTimeZone timeZone)

userTimeZone

public DateTimeFormatterFactoryStub userTimeZone(org.joda.time.DateTimeZone timeZone)

jiraLocale

public DateTimeFormatterFactoryStub jiraLocale(Locale locale)

userLocale

public DateTimeFormatterFactoryStub userLocale(Locale locale)

formatter

public DateTimeFormatter formatter()
Description copied from interface: DateTimeFormatterFactory
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();
 
A formatter obtained in this fashion may be safely reused across requests.

Specified by:
formatter in interface DateTimeFormatterFactory
Returns:
a new DateTimeFormatter


Copyright © 2002-2012 Atlassian. All Rights Reserved.