Package org.sonar.api.utils
Class Durations
- java.lang.Object
-
- org.sonar.api.utils.Durations
-
@ServerSide @ComputeEngineSide public class Durations extends java.lang.Object
- Since:
- 4.3
-
-
Constructor Summary
Constructors Constructor Description Durations()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Duration
create(long minutes)
Create a Duration object from a number of minutesDuration
decode(java.lang.String duration)
Convert the text to a Duration
Example : decode("9d 10 h") -> Duration.encode("10d2h")java.lang.String
encode(Duration duration)
Return the string value of the Duration.java.lang.String
format(Duration duration)
Return the formatted work duration using the english bundles.
-
-
-
Method Detail
-
create
public Duration create(long minutes)
Create a Duration object from a number of minutes
-
decode
public Duration decode(java.lang.String duration)
Convert the text to a Duration
Example : decode("9d 10 h") -> Duration.encode("10d2h")- Throws:
java.lang.IllegalArgumentException
-
encode
public java.lang.String encode(Duration duration)
Return the string value of the Duration.
Example : encode(Duration.encode("9d 10h")) -> "10d2h"
-
format
public java.lang.String format(Duration duration)
Return the formatted work duration using the english bundles.
Example : format(Duration.encode("9d 10h")) -> 10d 2h
-
-