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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDurations.DurationFormatDeprecated.since 6.3, only one format is available
-
Constructor Summary
Constructors Constructor Description Durations()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description Durationcreate(long minutes)Create a Duration object from a number of minutesDurationdecode(java.lang.String duration)Convert the text to a Duration
Example : decode("9d 10 h") -> Duration.encode("10d2h")java.lang.Stringencode(Duration duration)Return the string value of the Duration.java.lang.Stringformat(java.util.Locale locale, Duration duration)Deprecated.since 6.3 as theLocale.ENGLISHis always used.java.lang.Stringformat(java.util.Locale locale, Duration duration, Durations.DurationFormat format)Deprecated.since 6.3 as theLocale.ENGLISHis always used.java.lang.Stringformat(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
@Deprecated public java.lang.String format(java.util.Locale locale, Duration duration, Durations.DurationFormat format)Deprecated.since 6.3 as theLocale.ENGLISHis always used. Useformat(Duration)insteadReturn the formatted work duration.
-
format
@Deprecated public java.lang.String format(java.util.Locale locale, Duration duration)Deprecated.since 6.3 as theLocale.ENGLISHis always used. Useformat(Duration)insteadReturn the formatted work duration.
Example : format(Locale.FRENCH, Duration.encode("9d 10h"), DurationFormat.SHORT) -> 10d 2d
-
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
-
-