Package com.adobe.xmp.core
Interface XMPNode
- All Known Subinterfaces:
XMPArray,XMPMetadata,XMPQualifiers,XMPSimple,XMPStruct
The basic node class. Every node in the XMP tree is of this type.
It is iterable, so the tree can be iterated without knowing the exact type
upfront.
In case of a struct it will iterate the child nodes,
in case of an array, it will iterate the array items and in the case of
a simple property (leaf node) it will return null or a qualifier, if it has any.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(XMPNodeVisitor visitor) Executes the provided visitorGet a qualifier "facade" for this Node that allows management of qualifiers.<AdapterType>
AdapterTypeSave Cast to the type that is passed.voidcopyReplace(XMPNode copyFrom) Overwrites the current node with a deep copy of node which is provided as input.dump()returns a human readable version of this node tree (recursive)Return the node of the given path, relative to this node.Returns an array from the given path, relative to this node.Returns a language Alternative from the given path, relative to this node.getName()Returns the name of this node or null if it has no namereturns the namespace URI of this nodegets the parent of this node.Returns a simple property from the given path, relative to this node.Returns a struct property from the given path, relative to this node.Return the path of this XMPNodebooleanChecks if the node has qualifiers attached.booleanChecks if the node's parent is of type XMPArray.iterator()An unmodifiable Iterator that iterates over the child elements of this node.Remove a node at a given path, relative to this nodeintsize()Determine the number of node children.Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
iterator
An unmodifiable Iterator that iterates over the child elements of this node. If the node has no child elements, an empty iterator is returned. An eventual existing Qualifier Struct will not be visited by this iterator. -
accept
Executes the provided visitor- Parameters:
visitor- the Visitor to execute
-
accessQualifiers
XMPQualifiers accessQualifiers()Get a qualifier "facade" for this Node that allows management of qualifiers. Qualifiers are not part of the list of children of the node and can only be accessed through this helper object. Qualifier can be added to any node in the tree except XMPMetadata and Qualifiers itself.- Returns:
- the XMPQualifier facade or null if no qualifiers can be added to this node.
-
getName
String getName()Returns the name of this node or null if it has no name- Returns:
- the name of this node or null if it has no name
-
getParent
XMPNode getParent()gets the parent of this node.- Returns:
- returns the parent of this node or null if it has none (example: root element)
-
getNamespace
String getNamespace()returns the namespace URI of this node- Returns:
- the namespace URI or null, if this node is not qualified
-
adaptTo
Save Cast to the type that is passed. If the node is not of this type it will return null.- Parameters:
type- The class type this object should be casted to- Returns:
- the object casted to the desired type or null if the cast fails
-
copyReplace
Overwrites the current node with a deep copy of node which is provided as input. The node from which copying is done should not be null and it should be of same type as this node.- Parameters:
copyFrom- XMPNode which has to be copied- Throws:
IllegalArgumentException- If node sent as parameter to this method is null.IllegalStateException- If this metadata tree is invalid.
-
isArrayItem
boolean isArrayItem()Checks if the node's parent is of type XMPArray.- Returns:
- True if it is, false otherwise.
-
hasQualifiers
boolean hasQualifiers()Checks if the node has qualifiers attached.- Returns:
- True if it has, false otherwise.
-
size
int size()Determine the number of node children. For arrays, its the number of elements; for language alternatives the number of languages; for structs, the number of fields and for simple properties it is always zero.- Returns:
- Returns the number of node children.
-
getXMPPath
XMPPath getXMPPath()Return the path of this XMPNode- Returns:
- the path of this XMPNode
-
get
Return the node of the given path, relative to this node.- Parameters:
path- the path to the desired node relative to this node- Returns:
- the node at the path position or null if it could not be found
-
remove
Remove a node at a given path, relative to this node- Parameters:
path- the path to the node that shall be deleted- Returns:
- the removed node or null, if nothing is removed
- Throws:
XMPException- throws in case the remove path points to an xml:lang qualifier of a Language Alternative
-
getSimple
Returns a simple property from the given path, relative to this node.- Parameters:
path- the path to the simple property, relative to this node.- Returns:
- the desired simple property or null if there was none (or the type is different)
-
getStruct
Returns a struct property from the given path, relative to this node.- Parameters:
path- the path to the struct property, relative to this node.- Returns:
- the desired struct property or null if there was none (or the type is different)
-
getArray
Returns an array from the given path, relative to this node.- Parameters:
path- the path to the array, relative to this node.- Returns:
- the desired array or null if there was none (or the type is different)
-
getLanguageAlternative
Returns a language Alternative from the given path, relative to this node.- Parameters:
path- the path to the langAlt, relative to this node.- Returns:
- the desired langAlt or null if there was none (or the type is different)
-
dump
String dump()returns a human readable version of this node tree (recursive)- Returns:
- returns a human readable version of this node tree (recursive)
-