Package com.adobe.xmp.path
Class XMPPath
- java.lang.Object
-
- com.adobe.xmp.path.XMPPath
-
- All Implemented Interfaces:
Iterable<XMPPathSegment>,Collection<XMPPathSegment>,List<XMPPathSegment>
public class XMPPath extends Object implements 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, Collection<? extends XMPPathSegment> c)booleanaddAll(Collection<? extends XMPPathSegment> c)voidclear()XMPPath.Comparecompare(XMPPath path)Compares the provided path with this path.booleancontains(Object o)booleancontainsAll(Collection<?> c)booleanequals(Object obj)XMPPathSegmentget(int index)inthashCode()intindexOf(Object o)booleanisEmpty()Iterator<XMPPathSegment>iterator()intlastIndexOf(Object o)ListIterator<XMPPathSegment>listIterator()ListIterator<XMPPathSegment>listIterator(int index)static XMPPathparse(String path, Map<String,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(Object o)booleanremoveAll(Collection<?> c)booleanretainAll(Collection<?> c)Stringserialize()Serializes theXMPPathobject to a String representation.Stringserialize(Map<String,String> prefixContract)Serializes theXMPPathobject to a String representation.XMPPathSegmentset(int index, XMPPathSegment element)intsize()List<XMPPathSegment>subList(int fromIndex, int toIndex)Object[]toArray()<T> T[]toArray(T[] a)-
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
replaceAll, sort, spliterator
-
-
-
-
Method Detail
-
parse
public static XMPPath parse(String path, Map<String,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 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 String serialize(Map<String,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 interfaceCollection<XMPPathSegment>- Specified by:
sizein interfaceList<XMPPathSegment>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceCollection<XMPPathSegment>- Specified by:
isEmptyin interfaceList<XMPPathSegment>
-
contains
public boolean contains(Object o)
- Specified by:
containsin interfaceCollection<XMPPathSegment>- Specified by:
containsin interfaceList<XMPPathSegment>
-
iterator
public Iterator<XMPPathSegment> iterator()
- Specified by:
iteratorin interfaceCollection<XMPPathSegment>- Specified by:
iteratorin interfaceIterable<XMPPathSegment>- Specified by:
iteratorin interfaceList<XMPPathSegment>
-
toArray
public Object[] toArray()
- Specified by:
toArrayin interfaceCollection<XMPPathSegment>- Specified by:
toArrayin interfaceList<XMPPathSegment>
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArrayin interfaceCollection<XMPPathSegment>- Specified by:
toArrayin interfaceList<XMPPathSegment>
-
add
public boolean add(XMPPathSegment e)
- Specified by:
addin interfaceCollection<XMPPathSegment>- Specified by:
addin interfaceList<XMPPathSegment>
-
remove
public boolean remove(Object o)
- Specified by:
removein interfaceCollection<XMPPathSegment>- Specified by:
removein interfaceList<XMPPathSegment>
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAllin interfaceCollection<XMPPathSegment>- Specified by:
containsAllin interfaceList<XMPPathSegment>
-
addAll
public boolean addAll(Collection<? extends XMPPathSegment> c)
- Specified by:
addAllin interfaceCollection<XMPPathSegment>- Specified by:
addAllin interfaceList<XMPPathSegment>
-
addAll
public boolean addAll(int index, Collection<? extends XMPPathSegment> c)- Specified by:
addAllin interfaceList<XMPPathSegment>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAllin interfaceCollection<XMPPathSegment>- Specified by:
removeAllin interfaceList<XMPPathSegment>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAllin interfaceCollection<XMPPathSegment>- Specified by:
retainAllin interfaceList<XMPPathSegment>
-
clear
public void clear()
- Specified by:
clearin interfaceCollection<XMPPathSegment>- Specified by:
clearin interfaceList<XMPPathSegment>
-
get
public XMPPathSegment get(int index)
- Specified by:
getin interfaceList<XMPPathSegment>
-
set
public XMPPathSegment set(int index, XMPPathSegment element)
- Specified by:
setin interfaceList<XMPPathSegment>
-
add
public void add(int index, XMPPathSegment element)- Specified by:
addin interfaceList<XMPPathSegment>
-
remove
public XMPPathSegment remove(int index)
- Specified by:
removein interfaceList<XMPPathSegment>
-
indexOf
public int indexOf(Object o)
- Specified by:
indexOfin interfaceList<XMPPathSegment>
-
lastIndexOf
public int lastIndexOf(Object o)
- Specified by:
lastIndexOfin interfaceList<XMPPathSegment>
-
listIterator
public ListIterator<XMPPathSegment> listIterator()
- Specified by:
listIteratorin interfaceList<XMPPathSegment>
-
listIterator
public ListIterator<XMPPathSegment> listIterator(int index)
- Specified by:
listIteratorin interfaceList<XMPPathSegment>
-
subList
public List<XMPPathSegment> subList(int fromIndex, int toIndex)
- Specified by:
subListin interfaceList<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:
IllegalArgumentException- If path is null
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceCollection<XMPPathSegment>- Specified by:
hashCodein interfaceList<XMPPathSegment>- Overrides:
hashCodein classObject
-
equals
public boolean equals(Object obj)
- Specified by:
equalsin interfaceCollection<XMPPathSegment>- Specified by:
equalsin interfaceList<XMPPathSegment>- Overrides:
equalsin classObject
-
-