com.atlassian.jira.util
Class JiraDurationUtils.DaysDurationFormatter

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

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

This formatter formats time duration to days only. The resulting string returned is a real number representing the number of days. This value is then formatted according to system or user's locale.


Field Summary
static java.lang.String KEY_FORMAT_DAYS
           
 
Constructor Summary
JiraDurationUtils.DaysDurationFormatter(java.math.BigDecimal hoursPerDay, I18nHelper i18nBean)
           
JiraDurationUtils.DaysDurationFormatter(int hoursPerDay, I18nHelper i18nBean)
          Deprecated. #DaysDurationFormatter(BigDecimal, I18nHelper) is preferred now that we can fractional number of hours per day
 
Method Summary
 java.lang.String format(java.lang.Long duration)
          Converts the given time duration into days and formats it based on the system locale.
 java.lang.String format(java.lang.Long duration, java.util.Locale locale)
          Converts the given time duration into days and formats it based on the given user's locale.
 java.math.BigDecimal getHoursPerDay()
           
 java.lang.String getI18nKey()
           
 java.lang.String shortFormat(java.lang.Long duration)
          Formats a given time duration with given locale in the most compact way possible.
 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_DAYS

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

JiraDurationUtils.DaysDurationFormatter

public JiraDurationUtils.DaysDurationFormatter(int hoursPerDay,
                                               I18nHelper i18nBean)
Deprecated. #DaysDurationFormatter(BigDecimal, I18nHelper) is preferred now that we can fractional number of hours per day

Parameters:
hoursPerDay - numbers of hours in a day
i18nBean - i18nHelper to translate strings

JiraDurationUtils.DaysDurationFormatter

public JiraDurationUtils.DaysDurationFormatter(java.math.BigDecimal hoursPerDay,
                                               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)
Converts the given time duration into days and formats it based on the system locale. If the duration given is a negative number, returns an empty string.

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

format

public java.lang.String format(java.lang.Long duration,
                               java.util.Locale locale)
Converts the given time duration into days and formats it based on the given user's locale. If the duration given is a negative number, returns an empty string.

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

shortFormat

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

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

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()


Copyright © 2002-2010 Atlassian. All Rights Reserved.