Package io.github.pimak.ntfy.core
Class DurationParser
java.lang.Object
io.github.pimak.ntfy.core.DurationParser
Parses the several duration spellings the ntfy configuration surface accepts into a
Duration. Framework-neutral replacement for the old Logback Duration coercion:
- a bare integer is interpreted as milliseconds (
"500"=> 500ms); - a suffixed integer uses the unit suffix:
ms,s,m,h,d("5s","3m","2h","1d"); - an ISO-8601 duration is parsed by
Duration.parse(java.lang.CharSequence)("PT5S").
An unparseable value throws IllegalArgumentException.
-
Method Summary
-
Method Details
-
parse
Parsesvalueinto aDuration. See the class javadoc for the accepted forms.- Throws:
IllegalArgumentException- ifvalueisnull, blank, or unparseable
-