Class DurationParser

java.lang.Object
org.springframework.vault.support.DurationParser

public class DurationParser extends Object
Utility to parse a Go format duration into Duration.
Since:
2.3
Author:
Mark Paluch
See Also:
  • Constructor Details

    • DurationParser

      public DurationParser()
  • Method Details

    • parseDuration

      @Nullable public static Duration parseDuration(String duration)
      Parse a Go format duration into a Duration 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

      public static String formatDuration(Duration duration)
      Format a Duration into the Go format representation.
      Parameters:
      duration - the duration object to format.
      Returns:
      the duration formatted in Go's duration format.