Package org.pkl.core

Enum Class DataSizeUnit

java.lang.Object
java.lang.Enum<DataSizeUnit>
org.pkl.core.DataSizeUnit
All Implemented Interfaces:
Serializable, Comparable<DataSizeUnit>, Constable

public enum DataSizeUnit extends Enum<DataSizeUnit>
The unit of a DataSize. In Pkl, data size units are represented as String symbols.
  • Enum Constant Details

  • Method Details

    • values

      public static DataSizeUnit[] 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 DataSizeUnit 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
    • parse

      @Nullable public static @Nullable DataSizeUnit parse(String symbol)
      Returns the unit with the given symbol, or null if no unit with the given symbol exists.
    • getSymbol

      public String getSymbol()
      Returns the String symbol of this unit.
    • getBytes

      public long getBytes()
      Returns the conversion factor from this unit to bytes.
    • toString

      public String toString()
      Overrides:
      toString in class Enum<DataSizeUnit>