Enum Class Time.DurationFormatter

java.lang.Object
java.lang.Enum<Time.DurationFormatter>
dev.demeng.pluginbase.Time.DurationFormatter
All Implemented Interfaces:
Serializable, Comparable<Time.DurationFormatter>, Constable
Enclosing class:
Time

public static enum Time.DurationFormatter extends Enum<Time.DurationFormatter>
The duration formatters.
  • Enum Constant Details

    • LONG

      public static final Time.DurationFormatter LONG
      The long format: 3 weeks 2 days 1 hour.
    • CONCISE

      public static final Time.DurationFormatter CONCISE
      The concise format: 3w 2d 1h.
    • CONCISE_LOW_ACCURACY

      public static final Time.DurationFormatter CONCISE_LOW_ACCURACY
      The concise, but low accuracy (maximum 3 time units) format.
  • Method Details

    • values

      public static Time.DurationFormatter[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Time.DurationFormatter valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • format

      public String format(Duration duration)
      Convenience method for accessing format(Duration, boolean, int) through existing enumeration implementations.
      Parameters:
      duration - the duration
      Returns:
      the formatted string
    • format

      public static String format(Duration duration, boolean concise, int elements)
      Formats duration as a string, either in a concise (1 letter) or full length format, displaying up to the specified number of elements.
      Parameters:
      duration - The duration
      concise - If the output should be concisely formatted
      elements - The maximum number of elements to display
      Returns:
      the formatted string
    • format

      public static String format(Duration duration, boolean concise)
      Formats duration as a string, either in a concise (1 letter) or full length format, displaying all possible elements.
      Parameters:
      duration - The duration
      concise - If the output should be concisely formatted
      Returns:
      The formatted string