Example usage for java.time Duration parse

List of usage examples for java.time Duration parse

Introduction

In this page you can find the example usage for java.time Duration parse.

Prototype

public static Duration parse(CharSequence text) 

Source Link

Document

Obtains a Duration from a text string such as PnDTnHnMn.nS .

Usage

From source file:org.springframework.scheduling.annotation.ScheduledAnnotationBeanPostProcessor.java

private static long parseDelayAsLong(String value) throws RuntimeException {
    if (value.length() > 1 && (isP(value.charAt(0)) || isP(value.charAt(1)))) {
        return Duration.parse(value).toMillis();
    }/*  www. j a v  a 2s . co m*/
    return Long.parseLong(value);
}