|
Project Wonder 5.0 | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.text.Format
java.text.NumberFormat
er.extensions.formatters.ERXTimeDurationFormatter
public class ERXTimeDurationFormatter
User-presentable time duration format as days, hours, minutes and seconds.
Usage example:
StopWatch w = new StopWatch();
w.start();
... perform long task ...
w.stop();
ERXTimeDurationFormatter f = new ERXTimeDurationFormatter(TimeUnit.MILLISECONDS);
String message = "The task took " + f.format(w.getTime());
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.text.NumberFormat |
---|
java.text.NumberFormat.Field |
Field Summary |
---|
Fields inherited from class java.text.NumberFormat |
---|
FRACTION_FIELD, INTEGER_FIELD |
Constructor Summary | |
---|---|
ERXTimeDurationFormatter()
Defaults to TimeUnit.SECONDS, showing all time units and showing seconds part of the time description. |
|
ERXTimeDurationFormatter(java.util.concurrent.TimeUnit timeUnit)
Defaults to showing all time units and showing seconds part of the time description. |
|
ERXTimeDurationFormatter(java.util.concurrent.TimeUnit timeUnit,
boolean showLargestUnitOnly,
boolean omitSecondsPart)
|
Method Summary | |
---|---|
java.lang.StringBuffer |
format(double number,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition pos)
|
java.lang.StringBuffer |
format(long number,
java.lang.StringBuffer toAppendTo,
java.text.FieldPosition fieldPosition)
|
java.lang.Number |
parse(java.lang.String source,
java.text.ParsePosition parsePosition)
I know it is lame, but parsing is unsupported. |
Methods inherited from class java.text.NumberFormat |
---|
clone, equals, format, format, format, getAvailableLocales, getCurrency, getCurrencyInstance, getCurrencyInstance, getInstance, getInstance, getIntegerInstance, getIntegerInstance, getMaximumFractionDigits, getMaximumIntegerDigits, getMinimumFractionDigits, getMinimumIntegerDigits, getNumberInstance, getNumberInstance, getPercentInstance, getPercentInstance, getRoundingMode, hashCode, isGroupingUsed, isParseIntegerOnly, parse, parseObject, setCurrency, setGroupingUsed, setMaximumFractionDigits, setMaximumIntegerDigits, setMinimumFractionDigits, setMinimumIntegerDigits, setParseIntegerOnly, setRoundingMode |
Methods inherited from class java.text.Format |
---|
format, formatToCharacterIterator, parseObject |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ERXTimeDurationFormatter()
public ERXTimeDurationFormatter(java.util.concurrent.TimeUnit timeUnit)
timeUnit
- the unit of time which is milliseconds, seconds, etc.public ERXTimeDurationFormatter(java.util.concurrent.TimeUnit timeUnit, boolean showLargestUnitOnly, boolean omitSecondsPart)
timeUnit
- the unit of time which is milliseconds, seconds, etc.showLargestUnitOnly
- display the largest time unit (days, hours, minutes or seconds) that the time value rounds down toomitSecondsPart
- imit the seconds unit from the format.Method Detail |
---|
public java.lang.StringBuffer format(double number, java.lang.StringBuffer toAppendTo, java.text.FieldPosition pos)
format
in class java.text.NumberFormat
public java.lang.StringBuffer format(long number, java.lang.StringBuffer toAppendTo, java.text.FieldPosition fieldPosition)
format
in class java.text.NumberFormat
public java.lang.Number parse(java.lang.String source, java.text.ParsePosition parsePosition)
parse
in class java.text.NumberFormat
NumberFormat.parse(java.lang.String, java.text.ParsePosition)
|
Last updated: Tue, Feb 21, 2017 05:45 PM CET | |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |