gson-comments/gson/docs/javadocs/com/google/gson/JsonArray.html

681 lines
37 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.6.0_01) on Fri Aug 29 15:11:27 PDT 2008 -->
<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<TITLE>
JsonArray (Gson 1.2 API)
</TITLE>
<META NAME="date" CONTENT="2008-08-29">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="JsonArray (Gson 1.2 API)";
}
}
</SCRIPT>
<NOSCRIPT>
</NOSCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<HR>
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/JsonArray.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../com/google/gson/InstanceCreator.html" title="interface in com.google.gson"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../com/google/gson/JsonDeserializationContext.html" title="interface in com.google.gson"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?com/google/gson/JsonArray.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="JsonArray.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
com.google.gson</FONT>
<BR>
Class JsonArray</H2>
<PRE>
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</A>
<IMG SRC="../../../resources/inherit.gif" ALT="extended by "><A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson">com.google.gson.JsonElement</A>
<IMG SRC="../../../resources/inherit.gif" ALT="extended by "><B>com.google.gson.JsonArray</B>
</PRE>
<DL>
<DT><B>All Implemented Interfaces:</B> <DD><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A>&lt;<A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson">JsonElement</A>&gt;</DD>
</DL>
<HR>
<DL>
<DT><PRE>public final class <B>JsonArray</B><DT>extends <A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson">JsonElement</A><DT>implements <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A>&lt;<A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson">JsonElement</A>&gt;</DL>
</PRE>
<P>
A class representing an array type in Json. An array is a list of <A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson"><CODE>JsonElement</CODE></A>s each of
which can be of a different type. This is an ordered list, meaning that the order in which
elements are added is preserved.
<P>
<P>
<DL>
<DT><B>Author:</B></DT>
<DD>Inderjeet Singh</DD>
</DL>
<HR>
<P>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../com/google/gson/JsonArray.html#JsonArray()">JsonArray</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Creates an empty JsonArray.</TD>
</TR>
</TABLE>
&nbsp;
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="2"><FONT SIZE="+2">
<B>Method Summary</B></FONT></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/google/gson/JsonArray.html#add(com.google.gson.JsonElement)">add</A></B>(<A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson">JsonElement</A>&nbsp;element)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds the specified element to self.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/google/gson/JsonArray.html#addAll(com.google.gson.JsonArray)">addAll</A></B>(<A HREF="../../../com/google/gson/JsonArray.html" title="class in com.google.gson">JsonArray</A>&nbsp;array)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Adds all the elements of the specified array to self.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson">JsonElement</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/google/gson/JsonArray.html#get(int)">get</A></B>(int&nbsp;i)</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the ith element of the array.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html?is-external=true" title="class or interface in java.math">BigDecimal</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/google/gson/JsonArray.html#getAsBigDecimal()">getAsBigDecimal</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;convenience method to get this array as a <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html?is-external=true" title="class or interface in java.math"><CODE>BigDecimal</CODE></A> if it contains a single element.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/google/gson/JsonArray.html#getAsBigInteger()">getAsBigInteger</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;convenience method to get this array as a <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math"><CODE>BigInteger</CODE></A> if it contains a single element.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/google/gson/JsonArray.html#getAsBoolean()">getAsBoolean</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;convenience method to get this array as a boolean if it contains a single element.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;double</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/google/gson/JsonArray.html#getAsDouble()">getAsDouble</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;convenience method to get this array as a double if it contains a single element.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;float</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/google/gson/JsonArray.html#getAsFloat()">getAsFloat</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;convenience method to get this array as a float if it contains a single element.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/google/gson/JsonArray.html#getAsInt()">getAsInt</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;convenience method to get this array as an integer if it contains a single element.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/google/gson/JsonArray.html#getAsLong()">getAsLong</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;convenience method to get this array as a long if it contains a single element.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/google/gson/JsonArray.html#getAsNumber()">getAsNumber</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;convenience method to get this array as a <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang"><CODE>Number</CODE></A> if it contains a single element.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;short</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/google/gson/JsonArray.html#getAsShort()">getAsShort</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;convenience method to get this array as a primitive short if it contains a single element.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A></CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/google/gson/JsonArray.html#getAsString()">getAsString</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;convenience method to get this array as a <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang"><CODE>String</CODE></A> if it contains a single element.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A>&lt;<A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson">JsonElement</A>&gt;</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/google/gson/JsonArray.html#iterator()">iterator</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns an iterator to navigate the elemetns of the array.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../com/google/gson/JsonArray.html#size()">size</A></B>()</CODE>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns the number of elements in the array.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_com.google.gson.JsonElement"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class com.google.gson.<A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson">JsonElement</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="../../../com/google/gson/JsonElement.html#getAsJsonArray()">getAsJsonArray</A>, <A HREF="../../../com/google/gson/JsonElement.html#getAsJsonNull()">getAsJsonNull</A>, <A HREF="../../../com/google/gson/JsonElement.html#getAsJsonObject()">getAsJsonObject</A>, <A HREF="../../../com/google/gson/JsonElement.html#getAsJsonPrimitive()">getAsJsonPrimitive</A>, <A HREF="../../../com/google/gson/JsonElement.html#isJsonArray()">isJsonArray</A>, <A HREF="../../../com/google/gson/JsonElement.html#isJsonNull()">isJsonNull</A>, <A HREF="../../../com/google/gson/JsonElement.html#isJsonObject()">isJsonObject</A>, <A HREF="../../../com/google/gson/JsonElement.html#isJsonPrimitive()">isJsonPrimitive</A>, <A HREF="../../../com/google/gson/JsonElement.html#toString()">toString</A></CODE></TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TH ALIGN="left"><B>Methods inherited from class java.lang.<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</A></B></TH>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#equals(java.lang.Object)" title="class or interface in java.lang">equals</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#getClass()" title="class or interface in java.lang">getClass</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#hashCode()" title="class or interface in java.lang">hashCode</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#notify()" title="class or interface in java.lang">notify</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#notifyAll()" title="class or interface in java.lang">notifyAll</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait()" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait(long)" title="class or interface in java.lang">wait</A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Object.html?is-external=true#wait(long, int)" title="class or interface in java.lang">wait</A></CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="JsonArray()"><!-- --></A><H3>
JsonArray</H3>
<PRE>
public <B>JsonArray</B>()</PRE>
<DL>
<DD>Creates an empty JsonArray.
<P>
</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TH ALIGN="left" COLSPAN="1"><FONT SIZE="+2">
<B>Method Detail</B></FONT></TH>
</TR>
</TABLE>
<A NAME="add(com.google.gson.JsonElement)"><!-- --></A><H3>
add</H3>
<PRE>
public void <B>add</B>(<A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson">JsonElement</A>&nbsp;element)</PRE>
<DL>
<DD>Adds the specified element to self.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>element</CODE> - the element that needs to be added to the array.</DL>
</DD>
</DL>
<HR>
<A NAME="addAll(com.google.gson.JsonArray)"><!-- --></A><H3>
addAll</H3>
<PRE>
public void <B>addAll</B>(<A HREF="../../../com/google/gson/JsonArray.html" title="class in com.google.gson">JsonArray</A>&nbsp;array)</PRE>
<DL>
<DD>Adds all the elements of the specified array to self.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>array</CODE> - the array whose elements need to be added to the array.</DL>
</DD>
</DL>
<HR>
<A NAME="size()"><!-- --></A><H3>
size</H3>
<PRE>
public int <B>size</B>()</PRE>
<DL>
<DD>Returns the number of elements in the array.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the number of elements in the array.</DL>
</DD>
</DL>
<HR>
<A NAME="iterator()"><!-- --></A><H3>
iterator</H3>
<PRE>
public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Iterator.html?is-external=true" title="class or interface in java.util">Iterator</A>&lt;<A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson">JsonElement</A>&gt; <B>iterator</B>()</PRE>
<DL>
<DD>Returns an iterator to navigate the elemetns of the array. Since the array is an ordered list,
the iterator navigates the elements in the order they were inserted.
<P>
<DD><DL>
<DT><B>Specified by:</B><DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Iterable.html?is-external=true#iterator()" title="class or interface in java.lang">iterator</A></CODE> in interface <CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Iterable.html?is-external=true" title="class or interface in java.lang">Iterable</A>&lt;<A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson">JsonElement</A>&gt;</CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>an iterator to navigate the elements of the array.</DL>
</DD>
</DL>
<HR>
<A NAME="get(int)"><!-- --></A><H3>
get</H3>
<PRE>
public <A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson">JsonElement</A> <B>get</B>(int&nbsp;i)</PRE>
<DL>
<DD>Returns the ith element of the array.
<P>
<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>i</CODE> - the index of the element that is being sought.
<DT><B>Returns:</B><DD>the element present at the ith index.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IndexOutOfBoundsException.html?is-external=true" title="class or interface in java.lang">IndexOutOfBoundsException</A></CODE> - if i is negative or greater than or equal to the
<A HREF="../../../com/google/gson/JsonArray.html#size()"><CODE>size()</CODE></A> of the array.</DL>
</DD>
</DL>
<HR>
<A NAME="getAsNumber()"><!-- --></A><H3>
getAsNumber</H3>
<PRE>
public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang">Number</A> <B>getAsNumber</B>()</PRE>
<DL>
<DD>convenience method to get this array as a <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Number.html?is-external=true" title="class or interface in java.lang"><CODE>Number</CODE></A> if it contains a single element.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../com/google/gson/JsonElement.html#getAsNumber()">getAsNumber</A></CODE> in class <CODE><A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson">JsonElement</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>get this element as a number if it is single element array.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang">ClassCastException</A></CODE> - if the element in the array is of not a <A HREF="../../../com/google/gson/JsonPrimitive.html" title="class in com.google.gson"><CODE>JsonPrimitive</CODE></A> and
is not a valid Number.
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</A></CODE> - if the array has more than one element.</DL>
</DD>
</DL>
<HR>
<A NAME="getAsString()"><!-- --></A><H3>
getAsString</H3>
<PRE>
public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</A> <B>getAsString</B>()</PRE>
<DL>
<DD>convenience method to get this array as a <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang"><CODE>String</CODE></A> if it contains a single element.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../com/google/gson/JsonElement.html#getAsString()">getAsString</A></CODE> in class <CODE><A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson">JsonElement</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>get this element as a String if it is single element array.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang">ClassCastException</A></CODE> - if the element in the array is of not a <A HREF="../../../com/google/gson/JsonPrimitive.html" title="class in com.google.gson"><CODE>JsonPrimitive</CODE></A> and
is not a valid String.
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</A></CODE> - if the array has more than one element.</DL>
</DD>
</DL>
<HR>
<A NAME="getAsDouble()"><!-- --></A><H3>
getAsDouble</H3>
<PRE>
public double <B>getAsDouble</B>()</PRE>
<DL>
<DD>convenience method to get this array as a double if it contains a single element.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../com/google/gson/JsonElement.html#getAsDouble()">getAsDouble</A></CODE> in class <CODE><A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson">JsonElement</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>get this element as a double if it is single element array.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang">ClassCastException</A></CODE> - if the element in the array is of not a <A HREF="../../../com/google/gson/JsonPrimitive.html" title="class in com.google.gson"><CODE>JsonPrimitive</CODE></A> and
is not a valid double.
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</A></CODE> - if the array has more than one element.</DL>
</DD>
</DL>
<HR>
<A NAME="getAsBigDecimal()"><!-- --></A><H3>
getAsBigDecimal</H3>
<PRE>
public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html?is-external=true" title="class or interface in java.math">BigDecimal</A> <B>getAsBigDecimal</B>()</PRE>
<DL>
<DD>convenience method to get this array as a <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html?is-external=true" title="class or interface in java.math"><CODE>BigDecimal</CODE></A> if it contains a single element.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../com/google/gson/JsonElement.html#getAsBigDecimal()">getAsBigDecimal</A></CODE> in class <CODE><A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson">JsonElement</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>get this element as a <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html?is-external=true" title="class or interface in java.math"><CODE>BigDecimal</CODE></A> if it is single element array.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang">ClassCastException</A></CODE> - if the element in the array is of not a <A HREF="../../../com/google/gson/JsonPrimitive.html" title="class in com.google.gson"><CODE>JsonPrimitive</CODE></A>.
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/NumberFormatException.html?is-external=true" title="class or interface in java.lang">NumberFormatException</A></CODE> - if the element at index 0 is not a valid <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigDecimal.html?is-external=true" title="class or interface in java.math"><CODE>BigDecimal</CODE></A>.
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</A></CODE> - if the array has more than one element.<DT><B>Since:</B></DT>
<DD>1.2</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="getAsBigInteger()"><!-- --></A><H3>
getAsBigInteger</H3>
<PRE>
public <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math">BigInteger</A> <B>getAsBigInteger</B>()</PRE>
<DL>
<DD>convenience method to get this array as a <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math"><CODE>BigInteger</CODE></A> if it contains a single element.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../com/google/gson/JsonElement.html#getAsBigInteger()">getAsBigInteger</A></CODE> in class <CODE><A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson">JsonElement</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>get this element as a <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math"><CODE>BigInteger</CODE></A> if it is single element array.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang">ClassCastException</A></CODE> - if the element in the array is of not a <A HREF="../../../com/google/gson/JsonPrimitive.html" title="class in com.google.gson"><CODE>JsonPrimitive</CODE></A>.
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/NumberFormatException.html?is-external=true" title="class or interface in java.lang">NumberFormatException</A></CODE> - if the element at index 0 is not a valid <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/math/BigInteger.html?is-external=true" title="class or interface in java.math"><CODE>BigInteger</CODE></A>.
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</A></CODE> - if the array has more than one element.<DT><B>Since:</B></DT>
<DD>1.2</DD>
</DL>
</DD>
</DL>
<HR>
<A NAME="getAsFloat()"><!-- --></A><H3>
getAsFloat</H3>
<PRE>
public float <B>getAsFloat</B>()</PRE>
<DL>
<DD>convenience method to get this array as a float if it contains a single element.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../com/google/gson/JsonElement.html#getAsFloat()">getAsFloat</A></CODE> in class <CODE><A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson">JsonElement</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>get this element as a float if it is single element array.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang">ClassCastException</A></CODE> - if the element in the array is of not a <A HREF="../../../com/google/gson/JsonPrimitive.html" title="class in com.google.gson"><CODE>JsonPrimitive</CODE></A> and
is not a valid float.
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</A></CODE> - if the array has more than one element.</DL>
</DD>
</DL>
<HR>
<A NAME="getAsLong()"><!-- --></A><H3>
getAsLong</H3>
<PRE>
public long <B>getAsLong</B>()</PRE>
<DL>
<DD>convenience method to get this array as a long if it contains a single element.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../com/google/gson/JsonElement.html#getAsLong()">getAsLong</A></CODE> in class <CODE><A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson">JsonElement</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>get this element as a long if it is single element array.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang">ClassCastException</A></CODE> - if the element in the array is of not a <A HREF="../../../com/google/gson/JsonPrimitive.html" title="class in com.google.gson"><CODE>JsonPrimitive</CODE></A> and
is not a valid long.
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</A></CODE> - if the array has more than one element.</DL>
</DD>
</DL>
<HR>
<A NAME="getAsInt()"><!-- --></A><H3>
getAsInt</H3>
<PRE>
public int <B>getAsInt</B>()</PRE>
<DL>
<DD>convenience method to get this array as an integer if it contains a single element.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../com/google/gson/JsonElement.html#getAsInt()">getAsInt</A></CODE> in class <CODE><A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson">JsonElement</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>get this element as an integer if it is single element array.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang">ClassCastException</A></CODE> - if the element in the array is of not a <A HREF="../../../com/google/gson/JsonPrimitive.html" title="class in com.google.gson"><CODE>JsonPrimitive</CODE></A> and
is not a valid integer.
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</A></CODE> - if the array has more than one element.</DL>
</DD>
</DL>
<HR>
<A NAME="getAsShort()"><!-- --></A><H3>
getAsShort</H3>
<PRE>
public short <B>getAsShort</B>()</PRE>
<DL>
<DD>convenience method to get this array as a primitive short if it contains a single element.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../com/google/gson/JsonElement.html#getAsShort()">getAsShort</A></CODE> in class <CODE><A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson">JsonElement</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>get this element as a primitive short if it is single element array.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang">ClassCastException</A></CODE> - if the element in the array is of not a <A HREF="../../../com/google/gson/JsonPrimitive.html" title="class in com.google.gson"><CODE>JsonPrimitive</CODE></A> and
is not a valid short.
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</A></CODE> - if the array has more than one element.</DL>
</DD>
</DL>
<HR>
<A NAME="getAsBoolean()"><!-- --></A><H3>
getAsBoolean</H3>
<PRE>
public boolean <B>getAsBoolean</B>()</PRE>
<DL>
<DD>convenience method to get this array as a boolean if it contains a single element.
<P>
<DD><DL>
<DT><B>Overrides:</B><DD><CODE><A HREF="../../../com/google/gson/JsonElement.html#getAsBoolean()">getAsBoolean</A></CODE> in class <CODE><A HREF="../../../com/google/gson/JsonElement.html" title="class in com.google.gson">JsonElement</A></CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>get this element as a boolean if it is single element array.
<DT><B>Throws:</B>
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ClassCastException.html?is-external=true" title="class or interface in java.lang">ClassCastException</A></CODE> - if the element in the array is of not a <A HREF="../../../com/google/gson/JsonPrimitive.html" title="class in com.google.gson"><CODE>JsonPrimitive</CODE></A> and
is not a valid boolean.
<DD><CODE><A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalStateException.html?is-external=true" title="class or interface in java.lang">IllegalStateException</A></CODE> - if the array has more than one element.</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/JsonArray.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../com/google/gson/InstanceCreator.html" title="interface in com.google.gson"><B>PREV CLASS</B></A>&nbsp;
&nbsp;<A HREF="../../../com/google/gson/JsonDeserializationContext.html" title="interface in com.google.gson"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../index.html?com/google/gson/JsonArray.html" target="_top"><B>FRAMES</B></A> &nbsp;
&nbsp;<A HREF="JsonArray.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
&nbsp;<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Copyright &#169; 2008. All Rights Reserved.
</BODY>
</HTML>