Class DurationConverter

    • Constructor Detail

      • DurationConverter

        public DurationConverter()
    • Method Detail

      • convert

        public Duration convert​(String value)
        The converter accepts a value which start with a number by implicitly appending `PT` to it. If the value consists only of a number, it implicitly treats the value as seconds. Otherwise, tries to convert the value assuming that it is in the accepted ISO-8601 duration format.
        Specified by:
        convert in interface org.eclipse.microprofile.config.spi.Converter<Duration>
        Parameters:
        value - duration as String
        Returns:
        Duration
      • parseDuration

        public static Duration parseDuration​(String value)
        Converts a value which start with a number by implicitly appending `PT` to it. If the value consists only of a number, it implicitly treats the value as seconds. Otherwise, tries to convert the value assuming that it is in the accepted ISO-8601 duration format.
        Parameters:
        value - duration as String
        Returns:
        Duration