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>
XMPPathis a Class that provides an easy iterative description of a specific path into the XMP tree. EachXMPPathSegmentrepresents one segment of the path into the XMP tree.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classXMPPath.Compare
-
Constructor Summary
Constructors Constructor Description XMPPath()Creates an emptyXMPPathobject
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, XMPPathSegment element)booleanadd(XMPPathSegment e)booleanaddAll(int index, java.util.Collection<? extends XMPPathSegment> c)booleanaddAll(java.util.Collection<? extends XMPPathSegment> c)voidclear()XMPPath.Comparecompare(XMPPath path)Compares the provided path with this path.booleancontains(java.lang.Object o)booleancontainsAll(java.util.Collection<?> c)booleanequals(java.lang.Object obj)XMPPathSegmentget(int index)inthashCode()intindexOf(java.lang.Object o)booleanisEmpty()java.util.Iterator<XMPPathSegment>iterator()intlastIndexOf(java.lang.Object o)java.util.ListIterator<XMPPathSegment>listIterator()java.util.ListIterator<XMPPathSegment>listIterator(int index)static XMPPathparse(java.lang.String path, java.util.Map<java.lang.String,java.lang.String> prefixContract)Creates anXMPPathobject by parsing an XMP path String and creates one path segment for each detected segment in the path.XMPPathSegmentremove(int index)booleanremove(java.lang.Object o)booleanremoveAll(java.util.Collection<?> c)booleanretainAll(java.util.Collection<?> c)java.lang.Stringserialize()Serializes theXMPPathobject to a String representation.java.lang.Stringserialize(java.util.Map<java.lang.String,java.lang.String> prefixContract)Serializes theXMPPathobject to a String representation.XMPPathSegmentset(int index, XMPPathSegment element)intsize()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 anXMPPathobject 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 theXMPPathobject 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 theXMPPathobject 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:
sizein interfacejava.util.Collection<XMPPathSegment>- Specified by:
sizein interfacejava.util.List<XMPPathSegment>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfacejava.util.Collection<XMPPathSegment>- Specified by:
isEmptyin interfacejava.util.List<XMPPathSegment>
-
contains
public boolean contains(java.lang.Object o)
- Specified by:
containsin interfacejava.util.Collection<XMPPathSegment>- Specified by:
containsin interfacejava.util.List<XMPPathSegment>
-
iterator
public java.util.Iterator<XMPPathSegment> iterator()
- Specified by:
iteratorin interfacejava.util.Collection<XMPPathSegment>- Specified by:
iteratorin interfacejava.lang.Iterable<XMPPathSegment>- Specified by:
iteratorin interfacejava.util.List<XMPPathSegment>
-
toArray
public java.lang.Object[] toArray()
- Specified by:
toArrayin interfacejava.util.Collection<XMPPathSegment>- Specified by:
toArrayin interfacejava.util.List<XMPPathSegment>
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArrayin interfacejava.util.Collection<XMPPathSegment>- Specified by:
toArrayin interfacejava.util.List<XMPPathSegment>
-
add
public boolean add(XMPPathSegment e)
- Specified by:
addin interfacejava.util.Collection<XMPPathSegment>- Specified by:
addin interfacejava.util.List<XMPPathSegment>
-
remove
public boolean remove(java.lang.Object o)
- Specified by:
removein interfacejava.util.Collection<XMPPathSegment>- Specified by:
removein interfacejava.util.List<XMPPathSegment>
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
- Specified by:
containsAllin interfacejava.util.Collection<XMPPathSegment>- Specified by:
containsAllin interfacejava.util.List<XMPPathSegment>
-
addAll
public boolean addAll(java.util.Collection<? extends XMPPathSegment> c)
- Specified by:
addAllin interfacejava.util.Collection<XMPPathSegment>- Specified by:
addAllin interfacejava.util.List<XMPPathSegment>
-
addAll
public boolean addAll(int index, java.util.Collection<? extends XMPPathSegment> c)- Specified by:
addAllin interfacejava.util.List<XMPPathSegment>
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
- Specified by:
removeAllin interfacejava.util.Collection<XMPPathSegment>- Specified by:
removeAllin interfacejava.util.List<XMPPathSegment>
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
- Specified by:
retainAllin interfacejava.util.Collection<XMPPathSegment>- Specified by:
retainAllin interfacejava.util.List<XMPPathSegment>
-
clear
public void clear()
- Specified by:
clearin interfacejava.util.Collection<XMPPathSegment>- Specified by:
clearin interfacejava.util.List<XMPPathSegment>
-
get
public XMPPathSegment get(int index)
- Specified by:
getin interfacejava.util.List<XMPPathSegment>
-
set
public XMPPathSegment set(int index, XMPPathSegment element)
- Specified by:
setin interfacejava.util.List<XMPPathSegment>
-
add
public void add(int index, XMPPathSegment element)- Specified by:
addin interfacejava.util.List<XMPPathSegment>
-
remove
public XMPPathSegment remove(int index)
- Specified by:
removein interfacejava.util.List<XMPPathSegment>
-
indexOf
public int indexOf(java.lang.Object o)
- Specified by:
indexOfin interfacejava.util.List<XMPPathSegment>
-
lastIndexOf
public int lastIndexOf(java.lang.Object o)
- Specified by:
lastIndexOfin interfacejava.util.List<XMPPathSegment>
-
listIterator
public java.util.ListIterator<XMPPathSegment> listIterator()
- Specified by:
listIteratorin interfacejava.util.List<XMPPathSegment>
-
listIterator
public java.util.ListIterator<XMPPathSegment> listIterator(int index)
- Specified by:
listIteratorin interfacejava.util.List<XMPPathSegment>
-
subList
public java.util.List<XMPPathSegment> subList(int fromIndex, int toIndex)
- Specified by:
subListin 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:
hashCodein interfacejava.util.Collection<XMPPathSegment>- Specified by:
hashCodein interfacejava.util.List<XMPPathSegment>- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Specified by:
equalsin interfacejava.util.Collection<XMPPathSegment>- Specified by:
equalsin interfacejava.util.List<XMPPathSegment>- Overrides:
equalsin classjava.lang.Object
-
-