Class TomlUtils

java.lang.Object
land.oras.utils.TomlUtils

@NullMarked public final class TomlUtils extends Object
Utility class for TOML operations. Use Jackson 3 internally for TOML operations
  • Method Details

    • toToml

      public static String toToml(Object object)
      Convert an object to a TOML string
      Parameters:
      object - The object to convert
      Returns:
      The TOML string
    • fromToml

      public static <T> T fromToml(String toml, Class<T> clazz)
      Convert a TOML string to an object
      Type Parameters:
      T - The type of the object
      Parameters:
      toml - The TOML string
      clazz - The class of the object
      Returns:
      The object
    • fromToml

      public static <T> T fromToml(Path path, Class<T> clazz)
      Read a TOML file and convert its contents to an object. The file at the given path is read as UTF-8 TOML and deserialized into the specified type.
      Type Parameters:
      T - The type of the object
      Parameters:
      path - The path to the TOML file
      clazz - The class of the object
      Returns:
      The object deserialized from the TOML file