Package com.adobe.xmp.path
Class XMPPath
- java.lang.Object
-
- com.adobe.xmp.path.XMPPath
-
- All Implemented Interfaces:
java.lang.Iterable<XMPPathSegment>
,java.util.Collection<XMPPathSegment>
,java.util.List<XMPPathSegment>
public class XMPPath extends java.lang.Object implements java.util.List<XMPPathSegment>
XMPPath
is a Class that provides an easy iterative description of a specific path into the XMP tree. EachXMPPathSegment
represents one segment of the path into the XMP tree.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
XMPPath.Compare
-
Constructor Summary
Constructors Constructor Description XMPPath()
Creates an emptyXMPPath
object
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int index, XMPPathSegment element)
boolean
add(XMPPathSegment e)
boolean
addAll(int index, java.util.Collection<? extends XMPPathSegment> c)
boolean
addAll(java.util.Collection<? extends XMPPathSegment> c)
void
clear()
XMPPath.Compare
compare(XMPPath path)
Compares the provided path with this path.boolean
contains(java.lang.Object o)
boolean
containsAll(java.util.Collection<?> c)
boolean
equals(java.lang.Object obj)
XMPPathSegment
get(int index)
int
hashCode()
int
indexOf(java.lang.Object o)
boolean
isEmpty()
java.util.Iterator<XMPPathSegment>
iterator()
int
lastIndexOf(java.lang.Object o)
java.util.ListIterator<XMPPathSegment>
listIterator()
java.util.ListIterator<XMPPathSegment>
listIterator(int index)
static XMPPath
parse(java.lang.String path, java.util.Map<java.lang.String,java.lang.String> prefixContract)
Creates anXMPPath
object by parsing an XMP path String and creates one path segment for each detected segment in the path.XMPPathSegment
remove(int index)
boolean
remove(java.lang.Object o)
boolean
removeAll(java.util.Collection<?> c)
boolean
retainAll(java.util.Collection<?> c)
java.lang.String
serialize()
Serializes theXMPPath
object to a String representation.java.lang.String
serialize(java.util.Map<java.lang.String,java.lang.String> prefixContract)
Serializes theXMPPath
object to a String representation.XMPPathSegment
set(int index, XMPPathSegment element)
int
size()
java.util.List<XMPPathSegment>
subList(int fromIndex, int toIndex)
java.lang.Object[]
toArray()
<T> T[]
toArray(T[] a)
-
-
-
Method Detail
-
parse
public static XMPPath parse(java.lang.String path, java.util.Map<java.lang.String,java.lang.String> prefixContract) throws XMPPathParserException
Creates anXMPPath
object by parsing an XMP path String and creates one path segment for each detected segment in the path.- Parameters:
path
- Path string to parseprefixContract
- A Map that contains the mapping between Namespaces and their prefixes. This must be provided to interpret the path correctly. The key must be the prefix and the value the namespace!- Throws:
XMPPathParserException
- If the path has an invalid format or a prefix is found that is not defined in the prefixContract
-
serialize
public java.lang.String serialize()
Serializes theXMPPath
object to a String representation. This will produce a long form of the path using the full namespace strings.- Returns:
- String representation of the
XMPPath
-
serialize
public java.lang.String serialize(java.util.Map<java.lang.String,java.lang.String> prefixContract)
Serializes theXMPPath
object to a String representation. This produces a short form of the path using the prefixes provided by the contract.- Parameters:
prefixContract
- A Map that contains the mapping between Namespaces and their prefixes. The key must be the prefix and the value the namespace!- Returns:
- String representation of the
XMPPath
-
size
public int size()
- Specified by:
size
in interfacejava.util.Collection<XMPPathSegment>
- Specified by:
size
in interfacejava.util.List<XMPPathSegment>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfacejava.util.Collection<XMPPathSegment>
- Specified by:
isEmpty
in interfacejava.util.List<XMPPathSegment>
-
contains
public boolean contains(java.lang.Object o)
- Specified by:
contains
in interfacejava.util.Collection<XMPPathSegment>
- Specified by:
contains
in interfacejava.util.List<XMPPathSegment>
-
iterator
public java.util.Iterator<XMPPathSegment> iterator()
- Specified by:
iterator
in interfacejava.util.Collection<XMPPathSegment>
- Specified by:
iterator
in interfacejava.lang.Iterable<XMPPathSegment>
- Specified by:
iterator
in interfacejava.util.List<XMPPathSegment>
-
toArray
public java.lang.Object[] toArray()
- Specified by:
toArray
in interfacejava.util.Collection<XMPPathSegment>
- Specified by:
toArray
in interfacejava.util.List<XMPPathSegment>
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArray
in interfacejava.util.Collection<XMPPathSegment>
- Specified by:
toArray
in interfacejava.util.List<XMPPathSegment>
-
add
public boolean add(XMPPathSegment e)
- Specified by:
add
in interfacejava.util.Collection<XMPPathSegment>
- Specified by:
add
in interfacejava.util.List<XMPPathSegment>
-
remove
public boolean remove(java.lang.Object o)
- Specified by:
remove
in interfacejava.util.Collection<XMPPathSegment>
- Specified by:
remove
in interfacejava.util.List<XMPPathSegment>
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
- Specified by:
containsAll
in interfacejava.util.Collection<XMPPathSegment>
- Specified by:
containsAll
in interfacejava.util.List<XMPPathSegment>
-
addAll
public boolean addAll(java.util.Collection<? extends XMPPathSegment> c)
- Specified by:
addAll
in interfacejava.util.Collection<XMPPathSegment>
- Specified by:
addAll
in interfacejava.util.List<XMPPathSegment>
-
addAll
public boolean addAll(int index, java.util.Collection<? extends XMPPathSegment> c)
- Specified by:
addAll
in interfacejava.util.List<XMPPathSegment>
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
- Specified by:
removeAll
in interfacejava.util.Collection<XMPPathSegment>
- Specified by:
removeAll
in interfacejava.util.List<XMPPathSegment>
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
- Specified by:
retainAll
in interfacejava.util.Collection<XMPPathSegment>
- Specified by:
retainAll
in interfacejava.util.List<XMPPathSegment>
-
clear
public void clear()
- Specified by:
clear
in interfacejava.util.Collection<XMPPathSegment>
- Specified by:
clear
in interfacejava.util.List<XMPPathSegment>
-
get
public XMPPathSegment get(int index)
- Specified by:
get
in interfacejava.util.List<XMPPathSegment>
-
set
public XMPPathSegment set(int index, XMPPathSegment element)
- Specified by:
set
in interfacejava.util.List<XMPPathSegment>
-
add
public void add(int index, XMPPathSegment element)
- Specified by:
add
in interfacejava.util.List<XMPPathSegment>
-
remove
public XMPPathSegment remove(int index)
- Specified by:
remove
in interfacejava.util.List<XMPPathSegment>
-
indexOf
public int indexOf(java.lang.Object o)
- Specified by:
indexOf
in interfacejava.util.List<XMPPathSegment>
-
lastIndexOf
public int lastIndexOf(java.lang.Object o)
- Specified by:
lastIndexOf
in interfacejava.util.List<XMPPathSegment>
-
listIterator
public java.util.ListIterator<XMPPathSegment> listIterator()
- Specified by:
listIterator
in interfacejava.util.List<XMPPathSegment>
-
listIterator
public java.util.ListIterator<XMPPathSegment> listIterator(int index)
- Specified by:
listIterator
in interfacejava.util.List<XMPPathSegment>
-
subList
public java.util.List<XMPPathSegment> subList(int fromIndex, int toIndex)
- Specified by:
subList
in interfacejava.util.List<XMPPathSegment>
-
compare
public XMPPath.Compare compare(XMPPath path)
Compares the provided path with this path.- Parameters:
path
- the path to compare with- Returns:
- The paths are equal if both have the same size and each segment is EQUAL. If the provided path is a subpath of this path, ANCESTOR is returned. If the provided path is an ancestor of this path, DESCENDANT is returned. In all other cases the paths are DIFFERENT.
- Throws:
java.lang.IllegalArgumentException
- If path is null
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfacejava.util.Collection<XMPPathSegment>
- Specified by:
hashCode
in interfacejava.util.List<XMPPathSegment>
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equals
in interfacejava.util.Collection<XMPPathSegment>
- Specified by:
equals
in interfacejava.util.List<XMPPathSegment>
- Overrides:
equals
in classjava.lang.Object
-
-