xmlgraphics-commons 1.2

org.apache.xmlgraphics.xmp
Class XMPArray

java.lang.Object
  extended by org.apache.xmlgraphics.xmp.XMPComplexValue
      extended by org.apache.xmlgraphics.xmp.XMPArray
All Implemented Interfaces:
XMLizable

public class XMPArray
extends XMPComplexValue

Represents an XMP array as defined by the XMP specification.

To do:
Property qualifiers are currently not supported, yet.

Constructor Summary
XMPArray(XMPArrayType type)
          Main constructor
 
Method Summary
 void add(java.lang.Object value)
          Adds a new value to the array
 void add(java.lang.String value, java.lang.String lang)
          Adds a language-dependant value to the array.
 java.lang.String getLangValue(java.lang.String lang)
          Returns a language-dependant values (available for alternative arrays).
 java.lang.Object getSimpleValue()
          Returns a normal Java object representing the value if it is available.
 int getSize()
           
 XMPArrayType getType()
           
 java.lang.Object getValue(int idx)
          Returns the value at a given position
 void removeLangValue(java.lang.String lang)
          Removes a language-dependant value
 java.lang.Object[] toObjectArray()
          Converts the array to an object array.
 void toSAX(org.xml.sax.ContentHandler handler)
          Generates SAX events representing the object's state.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XMPArray

public XMPArray(XMPArrayType type)
Main constructor

Parameters:
type - the intended type of array
Method Detail

getType

public XMPArrayType getType()
Returns:
the type of array

getValue

public java.lang.Object getValue(int idx)
Returns the value at a given position

Parameters:
idx - the index of the requested value
Returns:
the value at the given position

getSimpleValue

public java.lang.Object getSimpleValue()
Description copied from class: XMPComplexValue
Returns a normal Java object representing the value if it is available.

Specified by:
getSimpleValue in class XMPComplexValue
Returns:
a simple object value or null if no such value can be returned (for example, because the value is an array and has multiple entries.
See Also:
XMPComplexValue.getSimpleValue()

getLangValue

public java.lang.String getLangValue(java.lang.String lang)
Returns a language-dependant values (available for alternative arrays).

Parameters:
lang - the language ("x-default" for the default value)
Returns:
the requested value

removeLangValue

public void removeLangValue(java.lang.String lang)
Removes a language-dependant value

Parameters:
lang - the language ("x-default" for the default value)

add

public void add(java.lang.Object value)
Adds a new value to the array

Parameters:
value - the value

add

public void add(java.lang.String value,
                java.lang.String lang)
Adds a language-dependant value to the array. Make sure not to add the same language twice.

Parameters:
value - the value
lang - the language ("x-default" for the default value)

getSize

public int getSize()
Returns:
the current number of value in the array

toObjectArray

public java.lang.Object[] toObjectArray()
Converts the array to an object array.

Returns:
an object array of all values in the array

toSAX

public void toSAX(org.xml.sax.ContentHandler handler)
           throws org.xml.sax.SAXException
Description copied from interface: XMLizable
Generates SAX events representing the object's state.

Parameters:
handler - ContentHandler instance to send the SAX events to
Throws:
org.xml.sax.SAXException - if there's a problem generating the SAX events
See Also:
XMLizable.toSAX(org.xml.sax.ContentHandler)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()

xmlgraphics-commons 1.2

Copyright 1999-2007 The Apache Software Foundation. All Rights Reserved.