Class TimeDurationFormatter
- java.lang.Object
-
- org.apache.jackrabbit.oak.commons.TimeDurationFormatter
-
public class TimeDurationFormatter extends Object
Format a time duration as human-readable string, inspired byStopwatch#toString().
-
-
Constructor Summary
Constructors Constructor Description TimeDurationFormatter(Locale locale, int threshold, boolean allowNonAscii)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TimeDurationFormatterforLogging()Default formatter suitable for logging (ASCII-only)Stringformat(long amount, TimeUnit unit)Format the specified duration
-
-
-
Constructor Detail
-
TimeDurationFormatter
public TimeDurationFormatter(Locale locale, int threshold, boolean allowNonAscii)
- Parameters:
locale- locale for formatting (affects the decimal point)threshold- integral value that needs to be exceeded to switch to a certain time unit for display (e.g., specify2to switch to 'days' when the elapsed time is two or more days.allowNonAscii- set totrueif the display unit can use the non-ASCII "micro" Unicode character
-
-
Method Detail
-
forLogging
public static TimeDurationFormatter forLogging()
Default formatter suitable for logging (ASCII-only)
-
-