Package io.dapr.utils
Class DurationUtils
java.lang.Object
io.dapr.utils.DurationUtils
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic DurationconvertDurationFromDaprFormat(String valueString) Converts time from the String format used by Dapr into a Duration.static StringConverts a Duration to the format used by the Dapr runtime.static StringConverts a Duration to the ISO 8601 duration format accepted by the Dapr runtime (e.g.
-
Constructor Details
-
DurationUtils
public DurationUtils()
-
-
Method Details
-
convertDurationFromDaprFormat
Converts time from the String format used by Dapr into a Duration.ISO 8601 durations (e.g. PT10S), optionally with repetitions (e.g. R5/PT10S), are also accepted, since the Dapr runtime echoes back the period exactly as it was registered. Repetitions are ignored.
- Parameters:
valueString- A String representing time in the Dapr runtime's format (e.g. 4h15m50s60ms).- Returns:
- A Duration
-
convertDurationToDaprFormat
Converts a Duration to the format used by the Dapr runtime.- Parameters:
value- Duration- Returns:
- The Duration formatted as a String in the format the Dapr runtime uses (e.g. 4h15m50s60ms)
-
convertDurationToIso8601Format
Converts a Duration to the ISO 8601 duration format accepted by the Dapr runtime (e.g. PT1H30M10S). The runtime only accepts whole seconds in this format.- Parameters:
value- Duration, must be non-negative and have no sub-second part.- Returns:
- The Duration formatted as an ISO 8601 duration.
-