com.atlassian.jira.util
Class JiraDurationUtils.PrettyDurationFormatter

java.lang.Object
  extended by com.atlassian.jira.util.JiraDurationUtils.PrettyDurationFormatter
All Implemented Interfaces:
JiraDurationUtils.DurationFormatter
Enclosing class:
JiraDurationUtils

public static class JiraDurationUtils.PrettyDurationFormatter
extends java.lang.Object
implements JiraDurationUtils.DurationFormatter

This formatter formats time duration to "pretty" format, such as 3 weeks, 2 days, 1 hour, 15 minutes. This value is formatted according to system or user's locale.


Field Summary
static java.lang.String KEY_FORMAT_PRETTY
           
 
Constructor Summary
JiraDurationUtils.PrettyDurationFormatter(java.math.BigDecimal hoursPerDay, java.math.BigDecimal daysPerWeek, I18nHelper i18nBean)
           
JiraDurationUtils.PrettyDurationFormatter(int hoursPerDay, int daysPerWeek, I18nHelper i18nBean)
           
 
Method Summary
 java.lang.String format(java.lang.Long duration)
          Formats a given time duration with default (system) locale.
 java.lang.String format(java.lang.Long duration, java.util.Locale locale)
          Formats a given time duration with given locale.
 java.math.BigDecimal getDaysPerWeek()
           
 java.math.BigDecimal getHoursPerDay()
           
 java.lang.String getI18nKey()
           
 java.lang.String shortFormat(java.lang.Long duration)
          Used by the Time Tracking report to show shorter durations than full pretty format.
 java.lang.String shortFormat(java.lang.Long duration, java.util.Locale locale)
          Formats a given time duration with the given locale in the most compact way possible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY_FORMAT_PRETTY

public static final java.lang.String KEY_FORMAT_PRETTY
See Also:
Constant Field Values
Constructor Detail

JiraDurationUtils.PrettyDurationFormatter

public JiraDurationUtils.PrettyDurationFormatter(int hoursPerDay,
                                                 int daysPerWeek,
                                                 I18nHelper i18nBean)

JiraDurationUtils.PrettyDurationFormatter

public JiraDurationUtils.PrettyDurationFormatter(java.math.BigDecimal hoursPerDay,
                                                 java.math.BigDecimal daysPerWeek,
                                                 I18nHelper i18nBean)
Method Detail

getI18nKey

public java.lang.String getI18nKey()
Specified by:
getI18nKey in interface JiraDurationUtils.DurationFormatter

format

public java.lang.String format(java.lang.Long duration)
Description copied from interface: JiraDurationUtils.DurationFormatter
Formats a given time duration with default (system) locale.

Specified by:
format in interface JiraDurationUtils.DurationFormatter
Parameters:
duration - time duration to format
Returns:
formatted time duration

format

public java.lang.String format(java.lang.Long duration,
                               java.util.Locale locale)
Description copied from interface: JiraDurationUtils.DurationFormatter
Formats a given time duration with given locale.

Specified by:
format in interface JiraDurationUtils.DurationFormatter
Parameters:
duration - time duration to format
locale - user's locale
Returns:
formatted time duration

shortFormat

public java.lang.String shortFormat(java.lang.Long duration)
Used by the Time Tracking report to show shorter durations than full pretty format.

Specified by:
shortFormat in interface JiraDurationUtils.DurationFormatter
Parameters:
duration - time duration to format
Returns:
a duration String in the format "1d 3h 30m".

shortFormat

public java.lang.String shortFormat(java.lang.Long duration,
                                    java.util.Locale locale)
Description copied from interface: JiraDurationUtils.DurationFormatter
Formats a given time duration with the given locale in the most compact way possible

Specified by:
shortFormat in interface JiraDurationUtils.DurationFormatter
Parameters:
duration - time duration in seconds
locale - locale to use
Returns:
formatted time duration

getHoursPerDay

public java.math.BigDecimal getHoursPerDay()

getDaysPerWeek

public java.math.BigDecimal getDaysPerWeek()


Copyright © 2002-2010 Atlassian. All Rights Reserved.