public final class TimeSpanParser
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static long |
parse(java.lang.String timeSpan,
java.util.concurrent.TimeUnit timeUnit)
Calls
parse(String, TimeUnit, long) with default 0. |
static long |
parse(java.lang.String timeSpan,
java.util.concurrent.TimeUnit timeUnit,
long defaultValue)
Parses a time span string and returns the time span according to the given unit.
|
public static long parse(java.lang.String timeSpan,
java.util.concurrent.TimeUnit timeUnit,
long defaultValue)
TimeUnit.MINUTES would result in the
value of 1440.
If the time span string could not be parsed or uses other suffixes than supported, an
IllegalArgumentException will be thrown.timeSpan - the string representing the time spantimeUnit - the TimeUnit to be useddefaultValue - the default value to use if the time span string was null or empty.TimeUnit.public static long parse(java.lang.String timeSpan,
java.util.concurrent.TimeUnit timeUnit)
parse(String, TimeUnit, long) with default 0.