APIdia Launch Partner
Top Description Inners Fields Constructors Methods
jdk.jpackage.internal.util

public final Class PListReader

extends Object
Class Inheritance
Static Imports
jdk.jpackage.internal.util.function.ThrowingSupplier.toSupplier

Property list (plist) file reader.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static record
private static class

Field Summary

Modifier and TypeField and Description
private final Node

Constructor Summary

AccessConstructor and Description
public
PListReader(Node
the node
node
)

Creates plist reader from the given node.

public
PListReader(byte[] xmlData)

Method Summary

Modifier and TypeMethod and Description
public Optional<Stream<Object>>
findArrayValue(String keyName, boolean fetchDictionaries)

public Optional<Boolean>
public Optional<PListReader>
private Optional<Node>
findNode(String keyName)

public Optional<List<String>>
public Optional<String>
findValue(String keyName)

public Stream<Object>

Returns:

the value of the array property with the specified name in the underlying "dict" element
queryArrayValue
(String
the name of an array property whose value to query
keyName
,
boolean
controls the type of objects of "dict" elements. If the value is true, Map<String, Object> type is used, and PListReader type otherwise.
fetchDictionaries
)

Returns the value of the given array property in the underlying "dict" element as a stream of Object-s.

public boolean

Returns:

the value of the boolean property with the specified name in the underlying "dict" element
queryBoolValue
(String
the name of a boolean property whose value to query
keyName
)

Returns the value of the given boolean property in the underlying "dict" element.

public PListReader

Returns:

the value of the "dict" property with the specified name in the underlying "dict" element
queryDictValue
(String
the name of a "dict" property whose value to query
keyName
)

Returns the value of the given "dict" property in the underlying "dict" element.

public List<String>

Returns:

the value of the array property with the specified name in the underlying "dict" element
queryStringArrayValue
(String
the name of an array property whose value to query
keyName
)

Returns the value of the given array property in the underlying "dict" element as a list of strings.

public String

Returns:

the value of the string property with the specified name in the underlying "dict" element
queryValue
(String
the name of a string property whose value to query
keyName
)

Returns the value of the given string property in the underlying "dict" element.

private Stream<Object>
readArray(Node node, boolean fetchDictionaries)

public Map<String, Object>

Returns:

the contents of the the underlying "dict" element as a Map
toMap
(boolean
controls the type of objects of nested "dict" elements. If the value is true, Map<String, Object> type is used, and PListReader type otherwise.
fetchDictionaries
)

Returns the contents of the the underlying "dict" element as a Map.

public XmlConsumer
private Optional<?>
tryCreateValue(Element e, boolean fetchDictionaries)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

rootback to summary
private final Node root

Constructor Detail

PListReaderback to summary
public PListReader(Node node)

Creates plist reader from the given node.

If the specified node is an element with the name "dict", the reader is bound to the specified node; otherwise, it is bound to the /plist/dict element in the document.

Parameters
node:Node

the node

Exceptions
NoSuchElementException:
if the specified node is not an element with name "dict" and there is no /plist/dict node in the document
PListReaderback to summary
public PListReader(byte[] xmlData) throws SAXException, IOException

Method Detail

findArrayValueback to summary
public Optional<Stream<Object>> findArrayValue(String keyName, boolean fetchDictionaries)
findBoolValueback to summary
public Optional<Boolean> findBoolValue(String keyName)
findDictValueback to summary
public Optional<PListReader> findDictValue(String keyName)
findNodeback to summary
private Optional<Node> findNode(String keyName)
findStringArrayValueback to summary
public Optional<List<String>> findStringArrayValue(String keyName)
findValueback to summary
public Optional<String> findValue(String keyName)
queryArrayValueback to summary
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:String

the name of an array property whose value to query

fetchDictionaries:boolean

controls the type of objects of "dict" elements. If the value is true, Map<String, Object> type is used, and PListReader type otherwise.

Returns:Stream<Object>

the value of the array property with the specified name in the underlying "dict" element

Exceptions
NoSuchElementException:
if there is no array key with the given name in the underlying "dict" element
queryBoolValueback to summary
public boolean queryBoolValue(String keyName)

Returns the value of the given boolean property in the underlying "dict" element.

Parameters
keyName:String

the name of a boolean property whose value to query

Returns:boolean

the value of the boolean property with the specified name in the underlying "dict" element

Exceptions
NoSuchElementException:
if there is no string property with the given name in the underlying "dict" element
queryDictValueback to summary
public PListReader queryDictValue(String keyName)

Returns the value of the given "dict" property in the underlying "dict" element.

Parameters
keyName:String

the name of a "dict" property whose value to query

Returns:PListReader

the value of the "dict" property with the specified name in the underlying "dict" element

Exceptions
NoSuchElementException:
if there is no "dict" property with the given name in the underlying "dict" element
queryStringArrayValueback to summary
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 queryArrayValue(String) on the specified property name by filtering Raw instances of type Raw.Type#STRING.

Parameters
keyName:String

the name of an array property whose value to query

Returns:List<String>

the value of the array property with the specified name in the underlying "dict" element

Exceptions
NoSuchElementException:
if there is no array property with the given name in the underlying "dict" element
queryValueback to summary
public String queryValue(String keyName)

Returns the value of the given string property in the underlying "dict" element.

Parameters
keyName:String

the name of a string property whose value to query

Returns:String

the value of the string property with the specified name in the underlying "dict" element

Exceptions
NoSuchElementException:
if there is no string property with the given name in the underlying "dict" element
readArrayback to summary
private Stream<Object> readArray(Node node, boolean fetchDictionaries)
toMapback to summary
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:boolean

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:Map<String, Object>

the contents of the the underlying "dict" element as a Map

toXmlConsumerback to summary
public XmlConsumer toXmlConsumer()
tryCreateValueback to summary
private Optional<?> tryCreateValue(Element e, boolean fetchDictionaries)
jdk.jpackage.internal.util back to summary

public final Record PListReader.Raw

extends Record
Class Inheritance
Record Components
value:String 
type:PListReader.Raw.Type 

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static enum

Field Summary

Modifier and TypeField and Description
private final PListReader.Raw.Type
type

Record Component accessed by type().

private final String
value

Record Component accessed by value().

Constructor Summary

AccessConstructor and Description
public
Raw(String value, PListReader.Raw.Type type)

Method Summary

Modifier and TypeMethod and Description
public final boolean
equals(Object o)

Implements abstract java.lang.Record.equals.

Indicates whether some other object is "equal to" this one.

public final int
hashCode()

Implements abstract java.lang.Record.hashCode.

Returns a hash code value for the record.

public final String
toString()

Implements abstract java.lang.Record.toString.

Returns a string representation of the record.

private static Optional<PListReader.Raw>
public PListReader.Raw.Type
type()

Record Component getter of type.

public String
value()

Record Component getter of value.

Field Detail

typeback to summary
private final PListReader.Raw.Type type

Record Component accessed by type().

valueback to summary
private final String value

Record Component accessed by value().

Constructor Detail

Rawback to summary
public Raw(String value, PListReader.Raw.Type type)

Method Detail

equalsback to summary
public final boolean equals(Object o)

Implements abstract java.lang.Record.equals.

Doc from java.lang.Record.equals.

Indicates whether some other object is "equal to" this one. In addition to the general contract of Object.equals, record classes must further obey the invariant that when a record instance is "copied" by passing the result of the record component accessor methods to the canonical constructor, as follows:

    R copy = new R(r.c1(), r.c2(), ..., r.cn());
then it must be the case that r.equals(copy).
hashCodeback to summary
public final int hashCode()

Implements abstract java.lang.Record.hashCode.

Doc from java.lang.Record.hashCode.

Returns a hash code value for the record. Obeys the general contract of Object.hashCode. For records, hashing behavior is constrained by the refined contract of Record.equals, so that any two records created from the same components must have the same hash code.

toStringback to summary
public final String toString()

Implements abstract java.lang.Record.toString.

Doc from java.lang.Record.toString.

Returns a string representation of the record. In accordance with the general contract of Object#toString(), the toString method returns a string that "textually represents" this record. The result should be a concise but informative representation that is easy for a person to read.

In addition to this general contract, record classes must further participate in the invariant that any two records which are equal must produce equal strings. This invariant is necessarily relaxed in the rare case where corresponding equal component values might fail to produce equal strings for themselves.

tryCreateback to summary
private static Optional<PListReader.Raw> tryCreate(Element e)
typeback to summary
public PListReader.Raw.Type type()

Record Component getter of type.

valueback to summary
public String value()

Record Component getter of value.

jdk.jpackage.internal.util back to summary

public final Enum PListReader.Raw.Type

extends Enum<PListReader.Raw.Type>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final PListReader.Raw.Type
public static final PListReader.Raw.Type
public static final PListReader.Raw.Type
public static final PListReader.Raw.Type
public static final PListReader.Raw.Type
public static final PListReader.Raw.Type

Constructor Summary

AccessConstructor and Description
private
Type()

Method Summary

Modifier and TypeMethod and Description
private static Optional<PListReader.Raw.Type>
public static PListReader.Raw.Type
public static PListReader.Raw.Type[]
Inherited from java.lang.Enum:
clonecompareTodescribeConstableequalsfinalizegetDeclaringClasshashCodenameordinaltoStringvalueOf

Field Detail

BOOLEANback to summary
public static final PListReader.Raw.Type BOOLEAN
DATAback to summary
public static final PListReader.Raw.Type DATA
DATEback to summary
public static final PListReader.Raw.Type DATE
INTEGERback to summary
public static final PListReader.Raw.Type INTEGER
REALback to summary
public static final PListReader.Raw.Type REAL
STRINGback to summary
public static final PListReader.Raw.Type STRING

Constructor Detail

Typeback to summary
private Type()

Method Detail

fromElementNameback to summary
private static Optional<PListReader.Raw.Type> fromElementName(String name)
valueOfback to summary
public static PListReader.Raw.Type valueOf(String name)
valuesback to summary
public static PListReader.Raw.Type[] values()
jdk.jpackage.internal.util back to summary

private final Class PListReader.XPathSingleton

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final XPath

Constructor Summary

AccessConstructor and Description
private

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

INSTANCEback to summary
private static final XPath INSTANCE

Constructor Detail

XPathSingletonback to summary
private XPathSingleton()