Package org.gitlab4j.api.utils
Class DurationUtils
- java.lang.Object
-
- org.gitlab4j.api.utils.DurationUtils
-
public class DurationUtils extends Object
-
-
Constructor Summary
Constructors Constructor Description DurationUtils()
-
Method Summary
Modifier and Type Method Description static int
parse(String durationString)
Parses a human readable duration string and calculates the number of seconds it represents.static String
toString(int durationSeconds)
Create a human readable duration string from seconds.static String
toString(int durationSeconds, boolean includeMonths)
Create a human readable duration string from seconds.
-
-
-
Method Detail
-
toString
public static final String toString(int durationSeconds)
Create a human readable duration string from seconds.- Parameters:
durationSeconds
- the total number of seconds in the duration- Returns:
- a human readable string representing the duration
-
toString
public static final String toString(int durationSeconds, boolean includeMonths)
Create a human readable duration string from seconds.- Parameters:
durationSeconds
- the total number of seconds in the durationincludeMonths
- when true will include months "mo", in the string otherwise uses "4w" for each month- Returns:
- a human readable string representing the duration
-
parse
public static final int parse(String durationString)
Parses a human readable duration string and calculates the number of seconds it represents.- Parameters:
durationString
- the human readable duration- Returns:
- the total number of seconds in the duration
-
-