Class DurationUtils

java.lang.Object
org.gitlab4j.api.utils.DurationUtils

public class DurationUtils extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static final int
    parse(String durationString)
    Parses a human readable duration string and calculates the number of seconds it represents.
    static final String
    toString(int durationSeconds)
    Create a human readable duration string from seconds.
    static final String
    toString(int durationSeconds, boolean includeMonths)
    Create a human readable duration string from seconds.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DurationUtils

      public DurationUtils()
  • Method Details

    • 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 duration
      includeMonths - 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