Class Plist

java.lang.Object
gmbh.pagina.tools.gradle.mac_app.Plist

public class Plist extends Object
A lazy XML builder object that represents an apple property list.
  • Constructor Details

    • Plist

      public Plist()
      Create the property list and set up a minimal XML structure.
  • Method Details

    • save

      public void save(File file) throws ParserConfigurationException, TransformerException
      Save the property list to a target file.
      Parameters:
      file - The file to write it to.
      Throws:
      ParserConfigurationException - If XML transformer setup fails.
      TransformerException - If writing the XML document fails.
    • addString

      public void addString(Node parent, String value)
      Add a <string> node to a parent element.
      Parameters:
      parent - The parent XML node to append to.
      value - The string value to store.
    • addKey

      public void addKey(Node parent, String value)
      Add a <key> node to a parent element.
      Parameters:
      parent - The parent XML node to append to.
      value - The key value to store.
    • addString

      public void addString(String value)
      Add a <string> node to the root dictionary.
      Parameters:
      value - The string value to store.
    • addKey

      public void addKey(String value)
      Add a <key> node to the root dictionary.
      Parameters:
      value - The key value to store.
    • createEntry

      public void createEntry(Node parent, String key, boolean value)
      Create an entry with a key and a boolean value in a parent node.
      Parameters:
      parent - The parent XML node.
      key - The plist key.
      value - The boolean value.
    • createEntry

      public void createEntry(String key, boolean value)
      Create an entry with a key and a boolean value in the root property list.
      Parameters:
      key - The plist key.
      value - The boolean value.
    • createEntry

      public void createEntry(Node parent, String key, String value)
      Create an entry with a key and a string value in a parent node.
      Parameters:
      parent - The parent XML node.
      key - The plist key.
      value - The string value.
    • createEntry

      public void createEntry(Node parent, String key, Object value)
      Create or replace an entry with a key and a plist-compatible value in a parent dictionary.
      Parameters:
      parent - The parent XML dictionary node.
      key - The plist key.
      value - The plist-compatible value.
    • createEntry

      public void createEntry(String key, String value)
      Create an entry with a key and a string value in the root property list.
      Parameters:
      key - The plist key.
      value - The string value.
    • createEntry

      public void createEntry(String key, Object value)
      Create or replace an entry with a key and a plist-compatible value in the root dictionary.
      Parameters:
      key - The plist key.
      value - The plist-compatible value.
    • createEntries

      public void createEntries(Node parent, Map<String,?> entries)
      Create or replace multiple entries in a parent dictionary.
      Parameters:
      parent - The parent XML dictionary node.
      entries - Key/value entries to apply.
    • createEntries

      public void createEntries(Map<String,?> entries)
      Create or replace multiple entries in the root dictionary.
      Parameters:
      entries - Key/value entries to apply.
    • javaX

      public void javaX(String mainClass, int minimumVersion, List<String> properties, List<String> vmOptions, Boolean startOnMainThread, List<String> mainArguments, String splashFile, Map<String,?> customEntries)
      Set up the JavaX block to integrate with UniversalJavaApplicationStub.
      Parameters:
      mainClass - The main class in the format com.package.Class
      minimumVersion - The minimum version of Java required.
      properties - Java system properties in -Dkey=value form.
      vmOptions - JVM options passed to the launcher.
      startOnMainThread - Whether to launch on the macOS main thread.
      mainArguments - Arguments passed to the Java main class.
      splashFile - Optional splash file name.
    • documentTypes

      public void documentTypes(DocumentType[] documentTypes)
      Set up document types the document can read/edit.
      Parameters:
      documentTypes - Document type definitions to write into CFBundleDocumentTypes .