Interface DurationParser
- All Known Implementing Classes:
DurationParser.Default
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface DurationParser
Parser for
Duration
s out of textual representation.-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
DurationParser.Default
-
Method Summary
Modifier and Type Method Description static DurationParser
New()
Pseudo-constructor method to create a newDurationParser
, withDurationUnit.MS
as default unit.static DurationParser
New(DurationUnit defaultUnit)
Pseudo-constructor method to create a newDurationParser
.Duration
parse(String text)
Tries to parse aDuration
out oftext
.
-
Method Details
-
parse
Tries to parse aDuration
out oftext
. It usually consists of an amount and an unit, e.g."1S"
or the ISO format, as described hereDuration.parse(CharSequence)
.- Parameters:
text
- the textual input- Returns:
- the parsed
Duration
- Throws:
IllegalArgumentException
- if the text couldn't be parsed to aDuration
- See Also:
DurationUnit
-
New
Pseudo-constructor method to create a newDurationParser
, withDurationUnit.MS
as default unit. -
New
Pseudo-constructor method to create a newDurationParser
.
-