redstone.xmlrpc
Class XmlRpcArray

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<E>
          extended by java.util.ArrayList<java.lang.Object>
              extended by redstone.xmlrpc.XmlRpcArray
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<java.lang.Object>, java.util.Collection<java.lang.Object>, java.util.List<java.lang.Object>, java.util.RandomAccess

public class XmlRpcArray
extends java.util.ArrayList<java.lang.Object>

An Array represents an XML-RPC array in its Java form. Essentially, it's just a java.util.ArrayList with utility methods for extracting members of any of the data types supported by the XML-RPC library. The class does not introduce any new field members which makes it no more expensive than a regular ArrayList.

To extract nested values from the list, use the new simplified accessors which perform the casting for you:

  boolean boolean = myList.getStruct( 0 ).getBoolean( "someBoolean" );

Author:
Greger Olsson
See Also:
Serialized Form

Constructor Summary
XmlRpcArray()
           
 
Method Summary
 XmlRpcArray getArray(int index)
          Returns the Array at the given index in the array.
 byte[] getBinary(int index)
          Returns the byte[] at the given index in the array.
 java.io.InputStream getBinaryAsStream(int index)
          Returns the byte[] with at the given index in the Array, as an input stream (currently, a java.io.ByteArrayInputStream).
 boolean getBoolean(int index)
          Returns the boolean at the given index in the array.
 java.lang.Boolean getBooleanWrapper(int index)
          Returns the Boolean wrapper at the given index in the array.
 java.util.Date getDate(int index)
          Returns the Date at the given index in the array.
 double getDouble(int index)
          Returns the Double at the given index in the array.
 java.lang.Double getDoubleWrapper(int index)
          Returns the Double wrapper at the given index in the array.
 int getInteger(int index)
          Returns the integer at the given index in the array.
 java.lang.Integer getIntegerWrapper(int index)
          Returns the Integer wrapper at the given index in the array.
 java.lang.String getString(int index)
          Returns the String at the given index in the array.
 XmlRpcStruct getStruct(int index)
          Returns the Struct at the given index in the array.
 
Methods inherited from class java.util.ArrayList
add, add, addAll, addAll, clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, remove, remove, set, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

XmlRpcArray

public XmlRpcArray()
Method Detail

getString

public java.lang.String getString(int index)
Returns the String at the given index in the array.

Parameters:
index - The index into the array to extract the value from.
Throws:
ArrayOutOfBoundsException - if index > size() - 1.
java.lang.ClassCastException - if the value at the given index is not a String.

getBoolean

public boolean getBoolean(int index)
Returns the boolean at the given index in the array.

Parameters:
index - The index into the array to extract the value from.
Throws:
ArrayOutOfBoundsException - if index > size() - 1.
java.lang.ClassCastException - if the value at the given index is not a Boolean.

getBooleanWrapper

public java.lang.Boolean getBooleanWrapper(int index)
Returns the Boolean wrapper at the given index in the array.

Parameters:
index - The index into the array to extract the value from.
Throws:
ArrayOutOfBoundsException - if index > size() - 1.
java.lang.ClassCastException - if the value at the given index is not a Boolean.

getInteger

public int getInteger(int index)
Returns the integer at the given index in the array.

Parameters:
index - The index into the array to extract the value from.
Throws:
ArrayOutOfBoundsException - if index > size() - 1.
java.lang.ClassCastException - if the value at the given index is not an Integer.

getIntegerWrapper

public java.lang.Integer getIntegerWrapper(int index)
Returns the Integer wrapper at the given index in the array.

Parameters:
index - The index into the array to extract the value from.
Throws:
ArrayOutOfBoundsException - if index > size() - 1.
java.lang.ClassCastException - if the value at the given index is not a Integer.

getDouble

public double getDouble(int index)
Returns the Double at the given index in the array.

Parameters:
index - The index into the array to extract the value from.
Throws:
ArrayOutOfBoundsException - if index > size() - 1.
java.lang.ClassCastException - if the value at the given index is not a Double.

getDoubleWrapper

public java.lang.Double getDoubleWrapper(int index)
Returns the Double wrapper at the given index in the array.

Parameters:
index - The index into the array to extract the value from.
Throws:
ArrayOutOfBoundsException - if index > size() - 1.
java.lang.ClassCastException - if the value at the given index is not a Double.

getArray

public XmlRpcArray getArray(int index)
Returns the Array at the given index in the array.

Parameters:
index - The index into the array to extract the value from.
Throws:
ArrayOutOfBoundsException - if index > size() - 1.
java.lang.ClassCastException - if the value at the given index is not an Array.

getStruct

public XmlRpcStruct getStruct(int index)
Returns the Struct at the given index in the array.

Parameters:
index - The index into the array to extract the value from.
Throws:
ArrayOutOfBoundsException - if index > size() - 1.
java.lang.ClassCastException - if the value at the given index is not a Struct.

getDate

public java.util.Date getDate(int index)
Returns the Date at the given index in the array.

Parameters:
index - The index into the array to extract the value from.
Throws:
ArrayOutOfBoundsException - if index > size() - 1.
java.lang.ClassCastException - if the value at the given index is not a Date.

getBinary

public byte[] getBinary(int index)
Returns the byte[] at the given index in the array.

Parameters:
index - The index into the array to extract the value from.
Throws:
ArrayOutOfBoundsException - if index > size() - 1.
java.lang.ClassCastException - if the value at the given index is not a byte[].

getBinaryAsStream

public java.io.InputStream getBinaryAsStream(int index)
Returns the byte[] with at the given index in the Array, as an input stream (currently, a java.io.ByteArrayInputStream).

Parameters:
key - The key of the value to extract.
Throws:
ArrayOutOfBoundsException - if index > size() - 1.
java.lang.ClassCastException - if the value at the given index is not a byte[].