Class DurationParser
java.lang.Object
org.springframework.vault.support.DurationParser
Utility to parse a Go format duration into
Duration
.- Since:
- 2.3
- Author:
- Mark Paluch
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
formatDuration
(Duration duration) Format aDuration
into the Go format representation.static Duration
parseDuration
(String duration) Parse a Go format duration into aDuration
object.
-
Constructor Details
-
DurationParser
public DurationParser()
-
-
Method Details
-
parseDuration
Parse a Go format duration into aDuration
object.- Parameters:
duration
- the duration string to parse in Go's duration format.- Returns:
- the duration object. Can be null if
duration
is empty. - Throws:
IllegalArgumentException
- if unable to parse the requested duration.
-
formatDuration
Format aDuration
into the Go format representation.- Parameters:
duration
- the duration object to format.- Returns:
- the duration formatted in Go's duration format.
-