public class MultiUnitTimeFormatter extends java.lang.Object implements TimeFormatter
Constructor and Description |
---|
MultiUnitTimeFormatter()
This is a shortcut constructor for a MultiUnitTimeFormatter.
|
MultiUnitTimeFormatter(java.util.concurrent.TimeUnit coarsestUnit,
java.util.concurrent.TimeUnit finestUnit)
This is a constructor for a MultiUnitTimeFormatter.
30 Minutes and 5 Seconds would be 0:30:05:000 if the coarsest TimeUnit is HOURS
and the finest TimeUnit is MILLISECONDS.
|
MultiUnitTimeFormatter(java.util.concurrent.TimeUnit coarsestUnit,
java.util.concurrent.TimeUnit finestUnit,
char separator)
Use this constructor for a MultiUnitTimeFormatter to choose a different separator than the
default separator ':'.
30 Minutes and 5 Seconds would be 0:30:05:000 if the coarsest TimeUnit is HOURS
and the finest TimeUnit is MILLISECONDS.
|
MultiUnitTimeFormatter(java.util.concurrent.TimeUnit coarsestUnit,
java.util.concurrent.TimeUnit finestUnit,
char separator,
java.lang.String unitString)
Use this constructor for a MultiUnitTimeFormatter to choose a different separator than the
default separator ':'.
30 Minutes and 5 Seconds would be 0:30:05:000 if the coarsest TimeUnit is HOURS
and the finest TimeUnit is MILLISECONDS.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
buildTimeString(TimeInstant instant)
Returns the String-Representation of the given TimeInstant.
|
java.lang.String |
buildTimeString(TimeSpan span)
Returns the String-Representation of the given TimeSpan.
|
java.lang.String |
getUnit()
The units used to format time span and time instants.
|
public MultiUnitTimeFormatter()
public MultiUnitTimeFormatter(java.util.concurrent.TimeUnit coarsestUnit, java.util.concurrent.TimeUnit finestUnit)
coarsestUnit
- TimeUnit: The coarsest TimeUnitfinestUnit
- TimeUnit: The finest TimeUnitpublic MultiUnitTimeFormatter(java.util.concurrent.TimeUnit coarsestUnit, java.util.concurrent.TimeUnit finestUnit, char separator)
coarsestUnit
- TimeUnit: The coarsest TimeUnitfinestUnit
- TimeUnit: The finest TimeUnitseparator
- char: The separator used to separate the TimeUnits.public MultiUnitTimeFormatter(java.util.concurrent.TimeUnit coarsestUnit, java.util.concurrent.TimeUnit finestUnit, char separator, java.lang.String unitString)
coarsestUnit
- TimeUnit: The coarsest TimeUnitfinestUnit
- TimeUnit: The finest TimeUnitseparator
- char: The separator used to separate the TimeUnits.unitString
- String: The String representing the time units in a custom way (will be built if set to null
)public java.lang.String buildTimeString(TimeInstant instant)
buildTimeString
in interface TimeFormatter
instant
- TimeInstant: the instant of time to be formattedpublic java.lang.String buildTimeString(TimeSpan span)
buildTimeString
in interface TimeFormatter
span
- TimeSpan: the instant of time to be formattedpublic java.lang.String getUnit()
TimeFormatter
getUnit
in interface TimeFormatter