758 lines
41 KiB
HTML
758 lines
41 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_22) on Wed Nov 24 15:31:18 PST 2010 -->
|
|
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
|
<TITLE>
|
|
GsonBuilder (Gson 1.6 API)
|
|
</TITLE>
|
|
|
|
<META NAME="date" CONTENT="2010-11-24">
|
|
|
|
<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="GsonBuilder (Gson 1.6 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> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/GsonBuilder.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
|
</TR>
|
|
</TABLE>
|
|
</TD>
|
|
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
|
</EM>
|
|
</TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
<A HREF="../../../com/google/gson/Gson.html" title="class in com.google.gson"><B>PREV CLASS</B></A>
|
|
<A HREF="../../../com/google/gson/InstanceCreator.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/GsonBuilder.html" target="_top"><B>FRAMES</B></A>
|
|
<A HREF="GsonBuilder.html" target="_top"><B>NO FRAMES</B></A>
|
|
<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: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
|
|
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
|
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <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 GsonBuilder</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 "><B>com.google.gson.GsonBuilder</B>
|
|
</PRE>
|
|
<HR>
|
|
<DL>
|
|
<DT><PRE>public final class <B>GsonBuilder</B><DT>extends <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></DL>
|
|
</PRE>
|
|
|
|
<P>
|
|
<p>Use this builder to construct a <A HREF="../../../com/google/gson/Gson.html" title="class in com.google.gson"><CODE>Gson</CODE></A> instance when you need to set configuration
|
|
options other than the default. For <A HREF="../../../com/google/gson/Gson.html" title="class in com.google.gson"><CODE>Gson</CODE></A> with default configuration, it is simpler to
|
|
use <code>new Gson()</code>. <code>GsonBuilder</code> is best used by creating it, and then invoking its
|
|
various configuration methods, and finally calling create.</p>
|
|
|
|
<p>The following is an example shows how to use the <code>GsonBuilder</code> to construct a Gson
|
|
instance:
|
|
|
|
<pre>
|
|
Gson gson = new GsonBuilder()
|
|
.registerTypeAdapter(Id.class, new IdTypeAdapter())
|
|
.serializeNulls()
|
|
.setDateFormat(DateFormat.LONG)
|
|
.setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE)
|
|
.setPrettyPrinting()
|
|
.setVersion(1.0)
|
|
.create();
|
|
</pre></p>
|
|
|
|
<p>NOTE: the order of invocation of configuration methods does not matter.</p>
|
|
<P>
|
|
|
|
<P>
|
|
<DL>
|
|
<DT><B>Author:</B></DT>
|
|
<DD>Inderjeet Singh, Joel Leitch</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/GsonBuilder.html#GsonBuilder()">GsonBuilder</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Creates a GsonBuilder instance that can be used to build Gson with various configuration
|
|
settings.</TD>
|
|
</TR>
|
|
</TABLE>
|
|
|
|
<!-- ========== 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> <A HREF="../../../com/google/gson/Gson.html" title="class in com.google.gson">Gson</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/google/gson/GsonBuilder.html#create()">create</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Creates a <A HREF="../../../com/google/gson/Gson.html" title="class in com.google.gson"><CODE>Gson</CODE></A> instance based on the current configuration.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/google/gson/GsonBuilder.html#disableHtmlEscaping()">disableHtmlEscaping</A></B>()</CODE>
|
|
|
|
<BR>
|
|
By default, Gson escapes HTML characters such as < > etc.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/google/gson/GsonBuilder.html#disableInnerClassSerialization()">disableInnerClassSerialization</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Configures Gson to exclude inner classes during serialization.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/google/gson/GsonBuilder.html#excludeFieldsWithModifiers(int...)">excludeFieldsWithModifiers</A></B>(int... modifiers)</CODE>
|
|
|
|
<BR>
|
|
Configures Gson to excludes all class fields that have the specified modifiers.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/google/gson/GsonBuilder.html#excludeFieldsWithoutExposeAnnotation()">excludeFieldsWithoutExposeAnnotation</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Configures Gson to exclude all fields from consideration for serialization or deserialization
|
|
that do not have the <A HREF="../../../com/google/gson/annotations/Expose.html" title="annotation in com.google.gson.annotations"><CODE>Expose</CODE></A> annotation.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/google/gson/GsonBuilder.html#generateNonExecutableJson()">generateNonExecutableJson</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Makes the output JSON non-executable in Javascript by prefixing the generated JSON with some
|
|
special text.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/google/gson/GsonBuilder.html#registerTypeAdapter(java.lang.reflect.Type, java.lang.Object)">registerTypeAdapter</A></B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/reflect/Type.html?is-external=true" title="class or interface in java.lang.reflect">Type</A> type,
|
|
<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> typeAdapter)</CODE>
|
|
|
|
<BR>
|
|
Configures Gson for custom serialization or deserialization.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/google/gson/GsonBuilder.html#serializeNulls()">serializeNulls</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Configure Gson to serialize null fields.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/google/gson/GsonBuilder.html#serializeSpecialFloatingPointValues()">serializeSpecialFloatingPointValues</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Section 2.4 of <a href="http://www.ietf.org/rfc/rfc4627.txt">JSON specification</a> disallows
|
|
special double values (NaN, Infinity, -Infinity).</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/google/gson/GsonBuilder.html#setDateFormat(int)">setDateFormat</A></B>(int style)</CODE>
|
|
|
|
<BR>
|
|
Configures Gson to to serialize <code>Date</code> objects according to the style value provided.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/google/gson/GsonBuilder.html#setDateFormat(int, int)">setDateFormat</A></B>(int dateStyle,
|
|
int timeStyle)</CODE>
|
|
|
|
<BR>
|
|
Configures Gson to to serialize <code>Date</code> objects according to the style value provided.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/google/gson/GsonBuilder.html#setDateFormat(java.lang.String)">setDateFormat</A></B>(<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> pattern)</CODE>
|
|
|
|
<BR>
|
|
Configures Gson to serialize <code>Date</code> objects according to the pattern provided.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/google/gson/GsonBuilder.html#setExclusionStrategies(com.google.gson.ExclusionStrategy...)">setExclusionStrategies</A></B>(<A HREF="../../../com/google/gson/ExclusionStrategy.html" title="interface in com.google.gson">ExclusionStrategy</A>... strategies)</CODE>
|
|
|
|
<BR>
|
|
Configures Gson to apply a set of exclusion strategies during both serialization and
|
|
deserialization.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/google/gson/GsonBuilder.html#setFieldNamingPolicy(com.google.gson.FieldNamingPolicy)">setFieldNamingPolicy</A></B>(<A HREF="../../../com/google/gson/FieldNamingPolicy.html" title="enum in com.google.gson">FieldNamingPolicy</A> namingConvention)</CODE>
|
|
|
|
<BR>
|
|
Configures Gson to apply a specific naming policy to an object's field during serialization
|
|
and deserialization.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/google/gson/GsonBuilder.html#setFieldNamingStrategy(com.google.gson.FieldNamingStrategy)">setFieldNamingStrategy</A></B>(<A HREF="../../../com/google/gson/FieldNamingStrategy.html" title="interface in com.google.gson">FieldNamingStrategy</A> fieldNamingStrategy)</CODE>
|
|
|
|
<BR>
|
|
Configures Gson to apply a specific naming policy strategy to an object's field during
|
|
serialization and deserialization.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/google/gson/GsonBuilder.html#setLongSerializationPolicy(com.google.gson.LongSerializationPolicy)">setLongSerializationPolicy</A></B>(<A HREF="../../../com/google/gson/LongSerializationPolicy.html" title="enum in com.google.gson">LongSerializationPolicy</A> serializationPolicy)</CODE>
|
|
|
|
<BR>
|
|
Configures Gson to apply a specific serialization policy for <code>Long</code> and <code>long</code>
|
|
objects.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/google/gson/GsonBuilder.html#setPrettyPrinting()">setPrettyPrinting</A></B>()</CODE>
|
|
|
|
<BR>
|
|
Configures Gson to output Json that fits in a page for pretty printing.</TD>
|
|
</TR>
|
|
<TR BGCOLOR="white" CLASS="TableRowColor">
|
|
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
|
|
<CODE> <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A></CODE></FONT></TD>
|
|
<TD><CODE><B><A HREF="../../../com/google/gson/GsonBuilder.html#setVersion(double)">setVersion</A></B>(double ignoreVersionsAfter)</CODE>
|
|
|
|
<BR>
|
|
Configures Gson to enable versioning support.</TD>
|
|
</TR>
|
|
</TABLE>
|
|
<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#toString()" title="class or interface in java.lang">toString</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>
|
|
|
|
<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="GsonBuilder()"><!-- --></A><H3>
|
|
GsonBuilder</H3>
|
|
<PRE>
|
|
public <B>GsonBuilder</B>()</PRE>
|
|
<DL>
|
|
<DD>Creates a GsonBuilder instance that can be used to build Gson with various configuration
|
|
settings. GsonBuilder follows the builder pattern, and it is typically used by first
|
|
invoking various configuration methods to set desired options, and finally calling
|
|
<A HREF="../../../com/google/gson/GsonBuilder.html#create()"><CODE>create()</CODE></A>.
|
|
<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="setVersion(double)"><!-- --></A><H3>
|
|
setVersion</H3>
|
|
<PRE>
|
|
public <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A> <B>setVersion</B>(double ignoreVersionsAfter)</PRE>
|
|
<DL>
|
|
<DD>Configures Gson to enable versioning support.
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>ignoreVersionsAfter</CODE> - any field or type marked with a version higher than this value
|
|
are ignored during serialization or deserialization.
|
|
<DT><B>Returns:</B><DD>a reference to this <code>GsonBuilder</code> object to fulfill the "Builder" pattern</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="excludeFieldsWithModifiers(int...)"><!-- --></A><H3>
|
|
excludeFieldsWithModifiers</H3>
|
|
<PRE>
|
|
public <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A> <B>excludeFieldsWithModifiers</B>(int... modifiers)</PRE>
|
|
<DL>
|
|
<DD>Configures Gson to excludes all class fields that have the specified modifiers. By default,
|
|
Gson will exclude all fields marked transient or static. This method will override that
|
|
behavior.
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>modifiers</CODE> - the field modifiers. You must use the modifiers specified in the
|
|
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/reflect/Modifier.html?is-external=true" title="class or interface in java.lang.reflect"><CODE>Modifier</CODE></A> class. For example,
|
|
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/reflect/Modifier.html?is-external=true#TRANSIENT" title="class or interface in java.lang.reflect"><CODE>Modifier.TRANSIENT</CODE></A>,
|
|
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/reflect/Modifier.html?is-external=true#STATIC" title="class or interface in java.lang.reflect"><CODE>Modifier.STATIC</CODE></A>.
|
|
<DT><B>Returns:</B><DD>a reference to this <code>GsonBuilder</code> object to fulfill the "Builder" pattern</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="generateNonExecutableJson()"><!-- --></A><H3>
|
|
generateNonExecutableJson</H3>
|
|
<PRE>
|
|
public <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A> <B>generateNonExecutableJson</B>()</PRE>
|
|
<DL>
|
|
<DD>Makes the output JSON non-executable in Javascript by prefixing the generated JSON with some
|
|
special text. This prevents attacks from third-party sites through script sourcing. See
|
|
<a href="http://code.google.com/p/google-gson/issues/detail?id=42">Gson Issue 42</a>
|
|
for details.
|
|
<P>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>a reference to this <code>GsonBuilder</code> object to fulfill the "Builder" pattern<DT><B>Since:</B></DT>
|
|
<DD>1.3</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="excludeFieldsWithoutExposeAnnotation()"><!-- --></A><H3>
|
|
excludeFieldsWithoutExposeAnnotation</H3>
|
|
<PRE>
|
|
public <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A> <B>excludeFieldsWithoutExposeAnnotation</B>()</PRE>
|
|
<DL>
|
|
<DD>Configures Gson to exclude all fields from consideration for serialization or deserialization
|
|
that do not have the <A HREF="../../../com/google/gson/annotations/Expose.html" title="annotation in com.google.gson.annotations"><CODE>Expose</CODE></A> annotation.
|
|
<P>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>a reference to this <code>GsonBuilder</code> object to fulfill the "Builder" pattern</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="serializeNulls()"><!-- --></A><H3>
|
|
serializeNulls</H3>
|
|
<PRE>
|
|
public <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A> <B>serializeNulls</B>()</PRE>
|
|
<DL>
|
|
<DD>Configure Gson to serialize null fields. By default, Gson omits all fields that are null
|
|
during serialization.
|
|
<P>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>a reference to this <code>GsonBuilder</code> object to fulfill the "Builder" pattern<DT><B>Since:</B></DT>
|
|
<DD>1.2</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="disableInnerClassSerialization()"><!-- --></A><H3>
|
|
disableInnerClassSerialization</H3>
|
|
<PRE>
|
|
public <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A> <B>disableInnerClassSerialization</B>()</PRE>
|
|
<DL>
|
|
<DD>Configures Gson to exclude inner classes during serialization.
|
|
<P>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>a reference to this <code>GsonBuilder</code> object to fulfill the "Builder" pattern<DT><B>Since:</B></DT>
|
|
<DD>1.3</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="setLongSerializationPolicy(com.google.gson.LongSerializationPolicy)"><!-- --></A><H3>
|
|
setLongSerializationPolicy</H3>
|
|
<PRE>
|
|
public <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A> <B>setLongSerializationPolicy</B>(<A HREF="../../../com/google/gson/LongSerializationPolicy.html" title="enum in com.google.gson">LongSerializationPolicy</A> serializationPolicy)</PRE>
|
|
<DL>
|
|
<DD>Configures Gson to apply a specific serialization policy for <code>Long</code> and <code>long</code>
|
|
objects.
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>serializationPolicy</CODE> - the particular policy to use for serializing longs.
|
|
<DT><B>Returns:</B><DD>a reference to this <code>GsonBuilder</code> object to fulfill the "Builder" pattern<DT><B>Since:</B></DT>
|
|
<DD>1.3</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="setFieldNamingPolicy(com.google.gson.FieldNamingPolicy)"><!-- --></A><H3>
|
|
setFieldNamingPolicy</H3>
|
|
<PRE>
|
|
public <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A> <B>setFieldNamingPolicy</B>(<A HREF="../../../com/google/gson/FieldNamingPolicy.html" title="enum in com.google.gson">FieldNamingPolicy</A> namingConvention)</PRE>
|
|
<DL>
|
|
<DD>Configures Gson to apply a specific naming policy to an object's field during serialization
|
|
and deserialization.
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>namingConvention</CODE> - the JSON field naming convention to use for serialization and
|
|
deserialization.
|
|
<DT><B>Returns:</B><DD>a reference to this <code>GsonBuilder</code> object to fulfill the "Builder" pattern</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="setFieldNamingStrategy(com.google.gson.FieldNamingStrategy)"><!-- --></A><H3>
|
|
setFieldNamingStrategy</H3>
|
|
<PRE>
|
|
public <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A> <B>setFieldNamingStrategy</B>(<A HREF="../../../com/google/gson/FieldNamingStrategy.html" title="interface in com.google.gson">FieldNamingStrategy</A> fieldNamingStrategy)</PRE>
|
|
<DL>
|
|
<DD>Configures Gson to apply a specific naming policy strategy to an object's field during
|
|
serialization and deserialization.
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>fieldNamingStrategy</CODE> - the actual naming strategy to apply to the fields
|
|
<DT><B>Returns:</B><DD>a reference to this <code>GsonBuilder</code> object to fulfill the "Builder" pattern<DT><B>Since:</B></DT>
|
|
<DD>1.3</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="setExclusionStrategies(com.google.gson.ExclusionStrategy...)"><!-- --></A><H3>
|
|
setExclusionStrategies</H3>
|
|
<PRE>
|
|
public <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A> <B>setExclusionStrategies</B>(<A HREF="../../../com/google/gson/ExclusionStrategy.html" title="interface in com.google.gson">ExclusionStrategy</A>... strategies)</PRE>
|
|
<DL>
|
|
<DD>Configures Gson to apply a set of exclusion strategies during both serialization and
|
|
deserialization. Each of the <code>strategies</code> will be applied as a disjunction rule.
|
|
This means that if one of the <code>strategies</code> suggests that a field (or class) should be
|
|
skipped then that field (or object) is skipped during serializaiton/deserialization.
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>strategies</CODE> - the set of strategy object to apply during object (de)serialization.
|
|
<DT><B>Returns:</B><DD>a reference to this <code>GsonBuilder</code> object to fulfill the "Builder" pattern<DT><B>Since:</B></DT>
|
|
<DD>1.4</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="setPrettyPrinting()"><!-- --></A><H3>
|
|
setPrettyPrinting</H3>
|
|
<PRE>
|
|
public <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A> <B>setPrettyPrinting</B>()</PRE>
|
|
<DL>
|
|
<DD>Configures Gson to output Json that fits in a page for pretty printing. This option only
|
|
affects Json serialization.
|
|
<P>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>a reference to this <code>GsonBuilder</code> object to fulfill the "Builder" pattern</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="disableHtmlEscaping()"><!-- --></A><H3>
|
|
disableHtmlEscaping</H3>
|
|
<PRE>
|
|
public <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A> <B>disableHtmlEscaping</B>()</PRE>
|
|
<DL>
|
|
<DD>By default, Gson escapes HTML characters such as < > etc. Use this option to configure
|
|
Gson to pass-through HTML characters as is.
|
|
<P>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>a reference to this <code>GsonBuilder</code> object to fulfill the "Builder" pattern<DT><B>Since:</B></DT>
|
|
<DD>1.3</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="setDateFormat(java.lang.String)"><!-- --></A><H3>
|
|
setDateFormat</H3>
|
|
<PRE>
|
|
public <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A> <B>setDateFormat</B>(<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> pattern)</PRE>
|
|
<DL>
|
|
<DD>Configures Gson to serialize <code>Date</code> objects according to the pattern provided. You can
|
|
call this method or <A HREF="../../../com/google/gson/GsonBuilder.html#setDateFormat(int)"><CODE>setDateFormat(int)</CODE></A> multiple times, but only the last invocation
|
|
will be used to decide the serialization format.
|
|
|
|
<p>Note that this pattern must abide by the convention provided by <code>SimpleDateFormat</code>
|
|
class. See the documentation in <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/text/SimpleDateFormat.html?is-external=true" title="class or interface in java.text"><CODE>SimpleDateFormat</CODE></A> for more information on
|
|
valid date and time patterns.</p>
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>pattern</CODE> - the pattern that dates will be serialized/deserialized to/from
|
|
<DT><B>Returns:</B><DD>a reference to this <code>GsonBuilder</code> object to fulfill the "Builder" pattern<DT><B>Since:</B></DT>
|
|
<DD>1.2</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="setDateFormat(int)"><!-- --></A><H3>
|
|
setDateFormat</H3>
|
|
<PRE>
|
|
public <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A> <B>setDateFormat</B>(int style)</PRE>
|
|
<DL>
|
|
<DD>Configures Gson to to serialize <code>Date</code> objects according to the style value provided.
|
|
You can call this method or <A HREF="../../../com/google/gson/GsonBuilder.html#setDateFormat(java.lang.String)"><CODE>setDateFormat(String)</CODE></A> multiple times, but only the last
|
|
invocation will be used to decide the serialization format.
|
|
|
|
<p>Note that this style value should be one of the predefined constants in the
|
|
<code>DateFormat</code> class. See the documentation in <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/text/DateFormat.html?is-external=true" title="class or interface in java.text"><CODE>DateFormat</CODE></A> for more
|
|
information on the valid style constants.</p>
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>style</CODE> - the predefined date style that date objects will be serialized/deserialized
|
|
to/from
|
|
<DT><B>Returns:</B><DD>a reference to this <code>GsonBuilder</code> object to fulfill the "Builder" pattern<DT><B>Since:</B></DT>
|
|
<DD>1.2</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="setDateFormat(int, int)"><!-- --></A><H3>
|
|
setDateFormat</H3>
|
|
<PRE>
|
|
public <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A> <B>setDateFormat</B>(int dateStyle,
|
|
int timeStyle)</PRE>
|
|
<DL>
|
|
<DD>Configures Gson to to serialize <code>Date</code> objects according to the style value provided.
|
|
You can call this method or <A HREF="../../../com/google/gson/GsonBuilder.html#setDateFormat(java.lang.String)"><CODE>setDateFormat(String)</CODE></A> multiple times, but only the last
|
|
invocation will be used to decide the serialization format.
|
|
|
|
<p>Note that this style value should be one of the predefined constants in the
|
|
<code>DateFormat</code> class. See the documentation in <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/text/DateFormat.html?is-external=true" title="class or interface in java.text"><CODE>DateFormat</CODE></A> for more
|
|
information on the valid style constants.</p>
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>dateStyle</CODE> - the predefined date style that date objects will be serialized/deserialized
|
|
to/from<DD><CODE>timeStyle</CODE> - the predefined style for the time portion of the date objects
|
|
<DT><B>Returns:</B><DD>a reference to this <code>GsonBuilder</code> object to fulfill the "Builder" pattern<DT><B>Since:</B></DT>
|
|
<DD>1.2</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="registerTypeAdapter(java.lang.reflect.Type, java.lang.Object)"><!-- --></A><H3>
|
|
registerTypeAdapter</H3>
|
|
<PRE>
|
|
public <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A> <B>registerTypeAdapter</B>(<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/reflect/Type.html?is-external=true" title="class or interface in java.lang.reflect">Type</A> type,
|
|
<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> typeAdapter)</PRE>
|
|
<DL>
|
|
<DD>Configures Gson for custom serialization or deserialization. This method combines the
|
|
registration of an <A HREF="../../../com/google/gson/InstanceCreator.html" title="interface in com.google.gson"><CODE>InstanceCreator</CODE></A>, <A HREF="../../../com/google/gson/JsonSerializer.html" title="interface in com.google.gson"><CODE>JsonSerializer</CODE></A>, and a
|
|
<A HREF="../../../com/google/gson/JsonDeserializer.html" title="interface in com.google.gson"><CODE>JsonDeserializer</CODE></A>. It is best used when a single object <code>typeAdapter</code> implements
|
|
all the required interfaces for custom serialization with Gson. If an instance creator,
|
|
serializer or deserializer was previously registered for the specified <code>type</code>, it is
|
|
overwritten.
|
|
<P>
|
|
<DD><DL>
|
|
<DT><B>Parameters:</B><DD><CODE>type</CODE> - the type definition for the type adapter being registered<DD><CODE>typeAdapter</CODE> - This object must implement at least one of the <A HREF="../../../com/google/gson/InstanceCreator.html" title="interface in com.google.gson"><CODE>InstanceCreator</CODE></A>,
|
|
<A HREF="../../../com/google/gson/JsonSerializer.html" title="interface in com.google.gson"><CODE>JsonSerializer</CODE></A>, and a <A HREF="../../../com/google/gson/JsonDeserializer.html" title="interface in com.google.gson"><CODE>JsonDeserializer</CODE></A> interfaces.
|
|
<DT><B>Returns:</B><DD>a reference to this <code>GsonBuilder</code> object to fulfill the "Builder" pattern</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="serializeSpecialFloatingPointValues()"><!-- --></A><H3>
|
|
serializeSpecialFloatingPointValues</H3>
|
|
<PRE>
|
|
public <A HREF="../../../com/google/gson/GsonBuilder.html" title="class in com.google.gson">GsonBuilder</A> <B>serializeSpecialFloatingPointValues</B>()</PRE>
|
|
<DL>
|
|
<DD>Section 2.4 of <a href="http://www.ietf.org/rfc/rfc4627.txt">JSON specification</a> disallows
|
|
special double values (NaN, Infinity, -Infinity). However,
|
|
<a href="http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf">Javascript
|
|
specification</a> (see section 4.3.20, 4.3.22, 4.3.23) allows these values as valid Javascript
|
|
values. Moreover, most JavaScript engines will accept these special values in JSON without
|
|
problem. So, at a practical level, it makes sense to accept these values as valid JSON even
|
|
though JSON specification disallows them.
|
|
|
|
<p>Gson always accepts these special values during deserialization. However, it outputs
|
|
strictly compliant JSON. Hence, if it encounters a float value <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Float.html?is-external=true#NaN" title="class or interface in java.lang"><CODE>Float.NaN</CODE></A>,
|
|
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Float.html?is-external=true#POSITIVE_INFINITY" title="class or interface in java.lang"><CODE>Float.POSITIVE_INFINITY</CODE></A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Float.html?is-external=true#NEGATIVE_INFINITY" title="class or interface in java.lang"><CODE>Float.NEGATIVE_INFINITY</CODE></A>, or a double value
|
|
<A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Double.html?is-external=true#NaN" title="class or interface in java.lang"><CODE>Double.NaN</CODE></A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Double.html?is-external=true#POSITIVE_INFINITY" title="class or interface in java.lang"><CODE>Double.POSITIVE_INFINITY</CODE></A>, <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Double.html?is-external=true#NEGATIVE_INFINITY" title="class or interface in java.lang"><CODE>Double.NEGATIVE_INFINITY</CODE></A>, it
|
|
will throw an <A HREF="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/IllegalArgumentException.html?is-external=true" title="class or interface in java.lang"><CODE>IllegalArgumentException</CODE></A>. This method provides a way to override the
|
|
default behavior when you know that the JSON receiver will be able to handle these special
|
|
values.
|
|
<P>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>a reference to this <code>GsonBuilder</code> object to fulfill the "Builder" pattern<DT><B>Since:</B></DT>
|
|
<DD>1.3</DD>
|
|
</DL>
|
|
</DD>
|
|
</DL>
|
|
<HR>
|
|
|
|
<A NAME="create()"><!-- --></A><H3>
|
|
create</H3>
|
|
<PRE>
|
|
public <A HREF="../../../com/google/gson/Gson.html" title="class in com.google.gson">Gson</A> <B>create</B>()</PRE>
|
|
<DL>
|
|
<DD>Creates a <A HREF="../../../com/google/gson/Gson.html" title="class in com.google.gson"><CODE>Gson</CODE></A> instance based on the current configuration. This method is free of
|
|
side-effects to this <code>GsonBuilder</code> instance and hence can be called multiple times.
|
|
<P>
|
|
<DD><DL>
|
|
|
|
<DT><B>Returns:</B><DD>an instance of Gson configured with the options currently set in this builder</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> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/GsonBuilder.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
|
|
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
|
|
</TR>
|
|
</TABLE>
|
|
</TD>
|
|
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
|
|
</EM>
|
|
</TD>
|
|
</TR>
|
|
|
|
<TR>
|
|
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
|
|
<A HREF="../../../com/google/gson/Gson.html" title="class in com.google.gson"><B>PREV CLASS</B></A>
|
|
<A HREF="../../../com/google/gson/InstanceCreator.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/GsonBuilder.html" target="_top"><B>FRAMES</B></A>
|
|
<A HREF="GsonBuilder.html" target="_top"><B>NO FRAMES</B></A>
|
|
<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: NESTED | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
|
|
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
|
|
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
|
|
</TR>
|
|
</TABLE>
|
|
<A NAME="skip-navbar_bottom"></A>
|
|
<!-- ======== END OF BOTTOM NAVBAR ======= -->
|
|
|
|
<HR>
|
|
Copyright © 2008-2010. All Rights Reserved.
|
|
</BODY>
|
|
</HTML>
|