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
Durations out of textual representation.-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static classDurationParser.Default -
Method Summary
Modifier and Type Method Description static DurationParserNew()Pseudo-constructor method to create a newDurationParser, withDurationUnit.MSas default unit.static DurationParserNew(DurationUnit defaultUnit)Pseudo-constructor method to create a newDurationParser.Durationparse(String text)Tries to parse aDurationout oftext.
-
Method Details
-
parse
Tries to parse aDurationout 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.MSas default unit. -
New
Pseudo-constructor method to create a newDurationParser.
-