Interface XMPArray

  • All Superinterfaces:
    java.lang.Iterable<XMPNode>, XMPNode

    public interface XMPArray
    extends XMPNode
    This represents a array in the XMP tree. There are 3 types of XMP arrays: unordered, ordered or alternative
    • Method Detail

      • getForm

        XMPArray.Form getForm()
        Returns the array Form (Unordered, ordered or alternative)
        Returns:
        the array Form
      • clear

        void clear()
        Delete all array elements
      • isEmpty

        boolean isEmpty()
        Checks if the array is empty
        Returns:
        True if the array is empty False otherwise
      • get

        XMPNode get​(int index)
        Returns the base item at position index (without knowing the special type)
        Parameters:
        index - the index of the array item to get
        Returns:
        the array item at position index (or throws IndexOutOfBoundsException if there is no node at position index)
        Throws:
        java.lang.IndexOutOfBoundsException - if index is not in range
      • remove

        XMPNode remove​(int index)
        Remove a node from position index
        Parameters:
        index - the index of the element to remove
        Returns:
        the removed child element
        Throws:
        java.lang.IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
      • getSimple

        XMPSimple getSimple​(int index)
        Get simple array item at position index
        Parameters:
        index - the index for the item to get
        Returns:
        the simple property or null if there was nothing to return or the type was wrong
      • getStruct

        XMPStruct getStruct​(int index)
        Get a struct array item at position index
        Parameters:
        index - the index for the item to get
        Returns:
        the struct property or null if there was nothing to return or the type was wrong
      • getArray

        XMPArray getArray​(int index)
        Get nested array property in this array at position index
        Parameters:
        index - the index for the item to get
        Returns:
        the array or null if there was nothing to return or the type was wrong
      • getLanguageAlternative

        XMPLanguageAlternative getLanguageAlternative​(int index)
        Get language alternative property in this array at position index
        Parameters:
        index - the index for the item to get
        Returns:
        the array or null if there was nothing to return or the type was wrong
      • appendSimple

        XMPSimple appendSimple​(java.lang.String value)
        Append new simple property to the end of the list
        Parameters:
        value - the value of the new property (namespace is the same as the host array)
        Returns:
        the newly appended property
      • appendStruct

        XMPStruct appendStruct()
        Append new empty struct property to the end of the list
        Returns:
        the newly appended property
      • appendArray

        XMPArray appendArray​(XMPArray.Form form)
        Append new empty array to the end of the list
        Parameters:
        form - the array form
        Returns:
        the newly appended property
      • appendLanguageAlternative

        XMPLanguageAlternative appendLanguageAlternative()
        Append new language alternative to the end of the list
        Returns:
        the newly appended property
      • setSimple

        XMPSimple setSimple​(int index,
                            java.lang.String value)
        Sets a new simple property at position index. This will overwrite any existing property at this index. If the index is equal to the size of the list, it will be appened.
        Parameters:
        index - the index to set the property
        value - the value of the property to set
        Returns:
        the new property at position index or null if nothing was overwritten/appended
      • setStruct

        XMPStruct setStruct​(int index)
        Sets a new struct at position index. This will overwrite any existing property at this index. If the index is equal to the size of the list, it will be appened.
        Parameters:
        index - the index to set the property
        Returns:
        the new property at position index or null if nothing was overwritten/appended
      • setArray

        XMPArray setArray​(int index,
                          XMPArray.Form form)
        Sets a new array at position index. This will overwrite any existing property at this index. If the index is equal to the size of the list, it will be appened.
        Parameters:
        index - the index to set the array
        form - the array form
        Returns:
        the new array at position index or null if nothing was overwritten/appended
      • setLanguageAlternative

        XMPLanguageAlternative setLanguageAlternative​(int index)
        Sets a new language alternative at position index. This will overwrite any existing property at this index. If the index is equal to the size of the list, it will be appened.
        Parameters:
        index - the index to set the language alternative
        Returns:
        the new language alternative at position index or null if nothing was overwritten/appended
      • insertSimple

        XMPSimple insertSimple​(int index,
                               java.lang.String value)
        Insert new simple property at position index and shift other array items to the back. The insert at the end of the list is similar to an append.
        Parameters:
        index - the index for the insert
        value - the value for the inserted new simple property
        Returns:
        the newly inserted simple property or null if nothing was inserted
      • insertStruct

        XMPStruct insertStruct​(int index)
        Insert new struct property at position index and shift other array items to the back. The insert at the end of the list is similar to an append.
        Parameters:
        index - the index for the insert
        Returns:
        the newly inserted struct property or null if nothing was inserted
      • insertArray

        XMPArray insertArray​(int index,
                             XMPArray.Form form)
        Insert new array at position index and shift other array items to the back. The insert at the end of the list is similar to an append.
        Parameters:
        index - the index for the insert
        form - the array form
        Returns:
        the newly inserted array or null if nothing was inserted
      • insertLanguageAlternative

        XMPLanguageAlternative insertLanguageAlternative​(int index)
        Insert new language alternative at position index and shift other array items to the back. The insert at the end of the list is similar to an append.
        Parameters:
        index - the index for the insert
        Returns:
        the newly inserted array or null if nothing was inserted
      • getXMPPath

        XMPPath getXMPPath()
        Return the path of this XMPNode
        Returns:
        the path of this XMPNode
      • get

        XMPNode get​(XMPPath path)
        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

        XMPNode remove​(XMPPath path)
                throws XMPException
        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

        XMPSimple getSimple​(XMPPath path)
        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

        XMPStruct getStruct​(XMPPath path)
        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

        XMPArray getArray​(XMPPath path)
        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

        XMPLanguageAlternative getLanguageAlternative​(XMPPath path)
        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

        java.lang.String dump()
        returns a human readable version of this node tree (recursive)
        Returns:
        returns a human readable version of this node tree (recursive)