Class PListReader

java.lang.Object
jdk.jpackage.internal.util.PListReader

public final class PListReader extends Object
Property list (plist) file reader.
  • Constructor Details

  • Method Details

    • toMap

      public Map<String,Object> toMap(boolean fetchDictionaries)
      Returns the contents of the the underlying "dict" element as a Map.

      The keys in the returned map are names of the properties.

      Values of nested "dict" properties are stored as Map<String, Object> or PListReader objects depending on the value of the fetchDictionaries parameter.

      Values of "array" properties are stored as List<Object> objects.

      Values of other properties are stored as Raw objects.

      Parameters:
      fetchDictionaries - controls the type of objects of nested "dict" elements. If the value is true, Map<String, Object> type is used, and PListReader type otherwise.
      Returns:
      the contents of the the underlying "dict" element as a Map
    • queryValue

      public String queryValue(String keyName)
      Returns the value of the given string property in the underlying "dict" element.
      Parameters:
      keyName - the name of a string property whose value to query
      Returns:
      the value of the string property with the specified name in the underlying "dict" element
      Throws:
      NoSuchElementException - if there is no string property with the given name in the underlying "dict" element
    • findValue

      public Optional<String> findValue(String keyName)
    • queryDictValue

      public PListReader queryDictValue(String keyName)
      Returns the value of the given "dict" property in the underlying "dict" element.
      Parameters:
      keyName - the name of a "dict" property whose value to query
      Returns:
      the value of the "dict" property with the specified name in the underlying "dict" element
      Throws:
      NoSuchElementException - if there is no "dict" property with the given name in the underlying "dict" element
    • findDictValue

      public Optional<PListReader> findDictValue(String keyName)
    • queryBoolValue

      public boolean queryBoolValue(String keyName)
      Returns the value of the given boolean property in the underlying "dict" element.
      Parameters:
      keyName - the name of a boolean property whose value to query
      Returns:
      the value of the boolean property with the specified name in the underlying "dict" element
      Throws:
      NoSuchElementException - if there is no string property with the given name in the underlying "dict" element
    • findBoolValue

      public Optional<Boolean> findBoolValue(String keyName)
    • queryStringArrayValue

      public List<String> queryStringArrayValue(String keyName)
      Returns the value of the given array property in the underlying "dict" element as a list of strings.

      Processes the result of calling

      invalid reference
      #queryArrayValue(String)
      on the specified property name by filtering PListReader.Raw instances of type PListReader.Raw.Type.STRING.
      Parameters:
      keyName - the name of an array property whose value to query
      Returns:
      the value of the array property with the specified name in the underlying "dict" element
      Throws:
      NoSuchElementException - if there is no array property with the given name in the underlying "dict" element
    • findStringArrayValue

      public Optional<List<String>> findStringArrayValue(String keyName)
    • queryArrayValue

      public Stream<Object> queryArrayValue(String keyName, boolean fetchDictionaries)
      Returns the value of the given array property in the underlying "dict" element as a stream of Object-s.

      Values of "dict" array items are stored as Map<String, Object> or PListReader objects depending on the value of the fetchDictionaries parameter.

      Values of "array" array items are stored as List<Object> objects.

      Values of other types are stored as Raw objects.

      Parameters:
      keyName - the name of an array property whose value to query
      fetchDictionaries - controls the type of objects of "dict" elements. If the value is true, Map<String, Object> type is used, and PListReader type otherwise.
      Returns:
      the value of the array property with the specified name in the underlying "dict" element
      Throws:
      NoSuchElementException - if there is no array key with the given name in the underlying "dict" element
    • findArrayValue

      public Optional<Stream<Object>> findArrayValue(String keyName, boolean fetchDictionaries)
    • toXmlConsumer

      public XmlConsumer toXmlConsumer()