diff --git a/gson/docs/javadocs/allclasses-frame.html b/gson/docs/javadocs/allclasses-frame.html new file mode 100644 index 00000000..98cf2b2b --- /dev/null +++ b/gson/docs/javadocs/allclasses-frame.html @@ -0,0 +1,92 @@ + + + + + + + +All Classes (Gson 1.6 API) + + + + + + + + + + + +All Classes +
+ + + + + +
ExclusionStrategy +
+Expose +
+FieldAttributes +
+FieldNamingPolicy +
+FieldNamingStrategy +
+Gson +
+GsonBuilder +
+InstanceCreator +
+JsonArray +
+JsonDeserializationContext +
+JsonDeserializer +
+JsonElement +
+JsonIOException +
+JsonNull +
+JsonObject +
+JsonParseException +
+JsonParser +
+JsonPrimitive +
+JsonReader +
+JsonSerializationContext +
+JsonSerializer +
+JsonStreamParser +
+JsonSyntaxException +
+JsonToken +
+JsonWriter +
+LongSerializationPolicy +
+MalformedJsonException +
+SerializedName +
+Since +
+TypeToken +
+Until +
+
+ + + diff --git a/gson/docs/javadocs/allclasses-noframe.html b/gson/docs/javadocs/allclasses-noframe.html new file mode 100644 index 00000000..68e08598 --- /dev/null +++ b/gson/docs/javadocs/allclasses-noframe.html @@ -0,0 +1,92 @@ + + + + + + + +All Classes (Gson 1.6 API) + + + + + + + + + + + +All Classes +
+ + + + + +
ExclusionStrategy +
+Expose +
+FieldAttributes +
+FieldNamingPolicy +
+FieldNamingStrategy +
+Gson +
+GsonBuilder +
+InstanceCreator +
+JsonArray +
+JsonDeserializationContext +
+JsonDeserializer +
+JsonElement +
+JsonIOException +
+JsonNull +
+JsonObject +
+JsonParseException +
+JsonParser +
+JsonPrimitive +
+JsonReader +
+JsonSerializationContext +
+JsonSerializer +
+JsonStreamParser +
+JsonSyntaxException +
+JsonToken +
+JsonWriter +
+LongSerializationPolicy +
+MalformedJsonException +
+SerializedName +
+Since +
+TypeToken +
+Until +
+
+ + + diff --git a/gson/docs/javadocs/com/google/gson/ExclusionStrategy.html b/gson/docs/javadocs/com/google/gson/ExclusionStrategy.html new file mode 100644 index 00000000..cbaa5a45 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/ExclusionStrategy.html @@ -0,0 +1,291 @@ + + + + + + + +ExclusionStrategy (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson +
+Interface ExclusionStrategy

+
+
+
public interface ExclusionStrategy
+ + +

+A strategy (or policy) definition that is used to decide whether or not a field or top-level + class should be serialized or deserialized as part of the JSON output/input. For serialization, + if the shouldSkipClass(Class) method returns false then that class or field type + will not be part of the JSON output. For deserialization, if shouldSkipClass(Class) + returns false, then it will not be set as part of the Java object structure. + +

The following are a few examples that shows how you can use this exclusion mechanism. + +

Exclude fields and objects based on a particular class type: +

+ private static class SpecificClassExclusionStrategy implements ExclusionStrategy {
+   private final Class<?> excludedThisClass;
+
+   public SpecificClassExclusionStrategy(Class<?> excludedThisClass) {
+     this.excludedThisClass = excludedThisClass;
+   }
+
+   public boolean shouldSkipClass(Class<?> clazz) {
+     return excludedThisClass.equals(clazz);
+   }
+
+   public boolean shouldSkipField(FieldAttributes f) {
+     return excludedThisClass.equals(f.getDeclaredClass());
+   }
+ }
+ 
+ +

Excludes fields and objects based on a particular annotation: +

+ public @interface FooAnnotation {
+   // some implementation here
+ }
+
+ // Excludes any field (or class) that is tagged with an "@FooAnnotation"
+ private static class FooAnnotationExclusionStrategy implements ExclusionStrategy {
+   public boolean shouldSkipClass(Class<?> clazz) {
+     return clazz.getAnnotation(FooAnnotation.class) != null;
+   }
+
+   public boolean shouldSkipField(FieldAttributes f) {
+     return f.getAnnotation(FooAnnotation.class) != null;
+   }
+ }
+ 
+ +

Now if you want to configure Gson to use a user defined exclusion strategy, then + the GsonBuilder is required. The following is an example of how you can use the + GsonBuilder to configure Gson to use one of the above sample: +

+ ExclusionStrategy excludeStrings = new UserDefinedExclusionStrategy(String.class);
+ Gson gson = new GsonBuilder()
+     .setExclusionStrategies(excludeStrings)
+     .create();
+ 
+

+ +

+

+
Since:
+
1.4
+
Author:
+
Inderjeet Singh, Joel Leitch
+
See Also:
GsonBuilder.setExclusionStrategies(ExclusionStrategy...)
+
+ +

+ + + + + + + + + + + + + + + + +
+Method Summary
+ booleanshouldSkipClass(Class<?> clazz) + +
+           
+ booleanshouldSkipField(FieldAttributes f) + +
+           
+  +

+ + + + + + + + +
+Method Detail
+ +

+shouldSkipField

+
+boolean shouldSkipField(FieldAttributes f)
+
+
+
Parameters:
f - the field object that is under test +
Returns:
true if the field should be ignored; otherwise false
+
+
+
+ +

+shouldSkipClass

+
+boolean shouldSkipClass(Class<?> clazz)
+
+
+
Parameters:
clazz - the class object that is under test +
Returns:
true if the class should be ignored; otherwise false
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/FieldAttributes.html b/gson/docs/javadocs/com/google/gson/FieldAttributes.html new file mode 100644 index 00000000..180d13ee --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/FieldAttributes.html @@ -0,0 +1,409 @@ + + + + + + + +FieldAttributes (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson +
+Class FieldAttributes

+
+java.lang.Object
+  extended by com.google.gson.FieldAttributes
+
+
+
+
public final class FieldAttributes
extends Object
+ + +

+A data object that stores attributes of a field. + +

This class is immutable; therefore, it can be safely shared across threads. +

+ +

+

+
Since:
+
1.4
+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ + + + + +
+<T extends Annotation> +
+T
+
getAnnotation(Class<T> annotation) + +
+          Return the T annotation object from this field if it exist; otherwise returns + null.
+ Collection<Annotation>getAnnotations() + +
+          Return the annotations that are present on this field.
+ Class<?>getDeclaredClass() + +
+          Returns the Class<?> object that was declared for this field.
+ TypegetDeclaredType() + +
+          For example, assume the following class definition: +
+ public class Foo {
+   private String bar;
+   private List<String> red;
+ }
+
+ Type listParmeterizedType = new TypeToken>() {}.getType();
+ Class<?>getDeclaringClass() + +
+           
+ StringgetName() + +
+           
+ booleanhasModifier(int modifier) + +
+          Returns true if the field is defined with the modifier.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Method Detail
+ +

+getDeclaringClass

+
+public Class<?> getDeclaringClass()
+
+
+ +
Returns:
the declaring class that contains this field
+
+
+
+ +

+getName

+
+public String getName()
+
+
+ +
Returns:
the name of the field
+
+
+
+ +

+getDeclaredType

+
+public Type getDeclaredType()
+
+

For example, assume the following class definition: +

+ public class Foo {
+   private String bar;
+   private List<String> red;
+ }
+
+ Type listParmeterizedType = new TypeToken>() {}.getType();
+ 
+ +

This method would return String.class for the bar field and + listParameterizedType for the red field. +

+

+ +
Returns:
the specific type declared for this field
+
+
+
+ +

+getDeclaredClass

+
+public Class<?> getDeclaredClass()
+
+
Returns the Class<?> object that was declared for this field. + +

For example, assume the following class definition: +

+ public class Foo {
+   private String bar;
+   private List<String> red;
+ }
+ 
+ +

This method would return String.class for the bar field and + List.class for the red field. +

+

+ +
Returns:
the specific class object that was declared for the field
+
+
+
+ +

+getAnnotation

+
+public <T extends Annotation> T getAnnotation(Class<T> annotation)
+
+
Return the T annotation object from this field if it exist; otherwise returns + null. +

+

+
Parameters:
annotation - the class of the annotation that will be retrieved +
Returns:
the annotation instance if it is bound to the field; otherwise null
+
+
+
+ +

+getAnnotations

+
+public Collection<Annotation> getAnnotations()
+
+
Return the annotations that are present on this field. +

+

+ +
Returns:
an array of all the annotations set on the field
Since:
+
1.4
+
+
+
+
+ +

+hasModifier

+
+public boolean hasModifier(int modifier)
+
+
Returns true if the field is defined with the modifier. + +

This method is meant to be called as: +

+ boolean hasPublicModifier = fieldAttribute.hasModifier(java.lang.reflect.Modifier.PUBLIC);
+ 
+

+

+
See Also:
Modifier
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/FieldNamingPolicy.html b/gson/docs/javadocs/com/google/gson/FieldNamingPolicy.html new file mode 100644 index 00000000..a03428dc --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/FieldNamingPolicy.html @@ -0,0 +1,420 @@ + + + + + + + +FieldNamingPolicy (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson +
+Enum FieldNamingPolicy

+
+java.lang.Object
+  extended by java.lang.Enum<FieldNamingPolicy>
+      extended by com.google.gson.FieldNamingPolicy
+
+
+
All Implemented Interfaces:
Serializable, Comparable<FieldNamingPolicy>
+
+
+
+
public enum FieldNamingPolicy
extends Enum<FieldNamingPolicy>
+ + +

+An enumeration that defines a few standard naming conventions for JSON field names. + This enumeration should be used in conjunction with GsonBuilder + to configure a Gson instance to properly translate Java field + names into the desired JSON field names. +

+ +

+

+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ +

+ + + + + + + + + + + + + + + + + + + +
+Enum Constant Summary
LOWER_CASE_WITH_DASHES + +
+          Using this naming policy with Gson will modify the Java Field name from its camel cased + form to a lower case field name where each word is separated by a dash (-).
LOWER_CASE_WITH_UNDERSCORES + +
+          Using this naming policy with Gson will modify the Java Field name from its camel cased + form to a lower case field name where each word is separated by an underscore (_).
UPPER_CAMEL_CASE + +
+          Using this naming policy with Gson will ensure that the first "letter" of the Java + field name is capitalized when serialized to its JSON form.
UPPER_CAMEL_CASE_WITH_SPACES + +
+          Using this naming policy with Gson will ensure that the first "letter" of the Java + field name is capitalized when serialized to its JSON form and the words will be + separated by a space.
+  + + + + + + + + + + + + + + + +
+Method Summary
+static FieldNamingPolicyvalueOf(String name) + +
+          Returns the enum constant of this type with the specified name.
+static FieldNamingPolicy[]values() + +
+          Returns an array containing the constants of this enum type, in +the order they are declared.
+ + + + + + + +
Methods inherited from class java.lang.Enum
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
+ + + + + + + +
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Enum Constant Detail
+ +

+UPPER_CAMEL_CASE

+
+public static final FieldNamingPolicy UPPER_CAMEL_CASE
+
+
Using this naming policy with Gson will ensure that the first "letter" of the Java + field name is capitalized when serialized to its JSON form. + +

Here's a few examples of the form "Java Field Name" ---> "JSON Field Name":

+ +

+

+
+
+
+ +

+UPPER_CAMEL_CASE_WITH_SPACES

+
+public static final FieldNamingPolicy UPPER_CAMEL_CASE_WITH_SPACES
+
+
Using this naming policy with Gson will ensure that the first "letter" of the Java + field name is capitalized when serialized to its JSON form and the words will be + separated by a space. + +

Here's a few examples of the form "Java Field Name" ---> "JSON Field Name":

+ +

+

+
Since:
+
1.4
+
+
+
+ +

+LOWER_CASE_WITH_UNDERSCORES

+
+public static final FieldNamingPolicy LOWER_CASE_WITH_UNDERSCORES
+
+
Using this naming policy with Gson will modify the Java Field name from its camel cased + form to a lower case field name where each word is separated by an underscore (_). + +

Here's a few examples of the form "Java Field Name" ---> "JSON Field Name":

+ +

+

+
+
+
+ +

+LOWER_CASE_WITH_DASHES

+
+public static final FieldNamingPolicy LOWER_CASE_WITH_DASHES
+
+
Using this naming policy with Gson will modify the Java Field name from its camel cased + form to a lower case field name where each word is separated by a dash (-). + +

Here's a few examples of the form "Java Field Name" ---> "JSON Field Name":

+ + Using dashes in JavaScript is not recommended since dash is also used for a minus sign in + expressions. This requires that a field named with dashes is always accessed as a quoted + property like myobject['my-field']. Accessing it as an object field + myobject.my-field will result in an unintended javascript expression. +

+

+
Since:
+
1.4
+
+
+ + + + + + + + +
+Method Detail
+ +

+values

+
+public static FieldNamingPolicy[] values()
+
+
Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
+for (FieldNamingPolicy c : FieldNamingPolicy.values())
+    System.out.println(c);
+
+

+

+ +
Returns:
an array containing the constants of this enum type, in +the order they are declared
+
+
+
+ +

+valueOf

+
+public static FieldNamingPolicy valueOf(String name)
+
+
Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.) +

+

+
Parameters:
name - the name of the enum constant to be returned. +
Returns:
the enum constant with the specified name +
Throws: +
IllegalArgumentException - if this enum type has no constant +with the specified name +
NullPointerException - if the argument is null
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/FieldNamingStrategy.html b/gson/docs/javadocs/com/google/gson/FieldNamingStrategy.html new file mode 100644 index 00000000..c8987d14 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/FieldNamingStrategy.html @@ -0,0 +1,224 @@ + + + + + + + +FieldNamingStrategy (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson +
+Interface FieldNamingStrategy

+
+
+
public interface FieldNamingStrategy
+ + +

+A mechanism for providing custom field naming in Gson. This allows the client code to translate + field names into a particular convention that is not supported as a normal Java field + declaration rules. For example, Java does not support "-" characters in a field name. +

+ +

+

+
Since:
+
1.3
+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ +

+ + + + + + + + + + + + +
+Method Summary
+ StringtranslateName(Field f) + +
+          Translates the field name into its JSON field name representation.
+  +

+ + + + + + + + +
+Method Detail
+ +

+translateName

+
+String translateName(Field f)
+
+
Translates the field name into its JSON field name representation. +

+

+
Parameters:
f - the field object that we are translating +
Returns:
the translated field name.
Since:
+
1.3
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/Gson.html b/gson/docs/javadocs/com/google/gson/Gson.html new file mode 100644 index 00000000..65ac33a0 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/Gson.html @@ -0,0 +1,944 @@ + + + + + + + +Gson (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson +
+Class Gson

+
+java.lang.Object
+  extended by com.google.gson.Gson
+
+
+
+
public final class Gson
extends Object
+ + +

+This is the main class for using Gson. Gson is typically used by first constructing a + Gson instance and then invoking toJson(Object) or fromJson(String, Class) + methods on it. + +

You can create a Gson instance by invoking new Gson() if the default configuration + is all you need. You can also use GsonBuilder to build a Gson instance with various + configuration options such as versioning support, pretty printing, custom + JsonSerializers, JsonDeserializers, and InstanceCreators.

+ +

Here is an example of how Gson is used for a simple Class: + +

+ Gson gson = new Gson(); // Or use new GsonBuilder().create();
+ MyType target = new MyType();
+ String json = gson.toJson(target); // serializes target to Json
+ MyType target2 = gson.fromJson(json, MyType.class); // deserializes json into target2
+ 

+ +

If the object that your are serializing/deserializing is a ParameterizedType + (i.e. contains at least one type parameter and may be an array) then you must use the + toJson(Object, Type) or fromJson(String, Type) method. Here is an + example for serializing and deserialing a ParameterizedType: + +

+ Type listType = new TypeToken<List<String>>() {}.getType();
+ List<String> target = new LinkedList<String>();
+ target.add("blah");
+
+ Gson gson = new Gson();
+ String json = gson.toJson(target, listType);
+ List<String> target2 = gson.fromJson(json, listType);
+ 

+ +

See the Gson User Guide + for a more complete set of examples.

+

+ +

+

+
Author:
+
Inderjeet Singh, Joel Leitch
+
See Also:
TypeToken
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
Gson() + +
+          Constructs a Gson object with default configuration.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ + + + + +
+<T> T
+
fromJson(JsonElement json, + Class<T> classOfT) + +
+          This method deserializes the Json read from the specified parse tree into an object of the + specified type.
+ + + + + +
+<T> T
+
fromJson(JsonElement json, + Type typeOfT) + +
+          This method deserializes the Json read from the specified parse tree into an object of the + specified type.
+ + + + + +
+<T> T
+
fromJson(JsonReader reader, + Type typeOfT) + +
+          Reads the next JSON value from reader and convert it to an object + of type typeOfT.
+ + + + + +
+<T> T
+
fromJson(Reader json, + Class<T> classOfT) + +
+          This method deserializes the Json read from the specified reader into an object of the + specified class.
+ + + + + +
+<T> T
+
fromJson(Reader json, + Type typeOfT) + +
+          This method deserializes the Json read from the specified reader into an object of the + specified type.
+ + + + + +
+<T> T
+
fromJson(String json, + Class<T> classOfT) + +
+          This method deserializes the specified Json into an object of the specified class.
+ + + + + +
+<T> T
+
fromJson(String json, + Type typeOfT) + +
+          This method deserializes the specified Json into an object of the specified type.
+ StringtoJson(JsonElement jsonElement) + +
+          Converts a tree of JsonElements into its equivalent JSON representation.
+ voidtoJson(JsonElement jsonElement, + Appendable writer) + +
+          Writes out the equivalent JSON for a tree of JsonElements.
+ voidtoJson(JsonElement jsonElement, + JsonWriter writer) + +
+          Writes the JSON for jsonElement to writer.
+ StringtoJson(Object src) + +
+          This method serializes the specified object into its equivalent Json representation.
+ voidtoJson(Object src, + Appendable writer) + +
+          This method serializes the specified object into its equivalent Json representation.
+ StringtoJson(Object src, + Type typeOfSrc) + +
+          This method serializes the specified object, including those of generic types, into its + equivalent Json representation.
+ voidtoJson(Object src, + Type typeOfSrc, + Appendable writer) + +
+          This method serializes the specified object, including those of generic types, into its + equivalent Json representation.
+ voidtoJson(Object src, + Type typeOfSrc, + JsonWriter writer) + +
+          Writes the JSON representation of src of type typeOfSrc to + writer.
+ JsonElementtoJsonTree(Object src) + +
+          This method serializes the specified object into its equivalent representation as a tree of + JsonElements.
+ JsonElementtoJsonTree(Object src, + Type typeOfSrc) + +
+          This method serializes the specified object, including those of generic types, into its + equivalent representation as a tree of JsonElements.
+ StringtoString() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+Gson

+
+public Gson()
+
+
Constructs a Gson object with default configuration. The default configuration has the + following settings: + +

+

+ + + + + + + + +
+Method Detail
+ +

+toJsonTree

+
+public JsonElement toJsonTree(Object src)
+
+
This method serializes the specified object into its equivalent representation as a tree of + JsonElements. This method should be used when the specified object is not a generic + type. This method uses Object.getClass() to get the type for the specified object, but + the getClass() loses the generic type information because of the Type Erasure feature + of Java. Note that this method works fine if the any of the object fields are of generic type, + just the object itself should not be of a generic type. If the object is of generic type, use + toJsonTree(Object, Type) instead. +

+

+
Parameters:
src - the object for which Json representation is to be created setting for Gson +
Returns:
Json representation of src.
Since:
+
1.4
+
+
+
+
+ +

+toJsonTree

+
+public JsonElement toJsonTree(Object src,
+                              Type typeOfSrc)
+
+
This method serializes the specified object, including those of generic types, into its + equivalent representation as a tree of JsonElements. This method must be used if the + specified object is a generic type. For non-generic objects, use toJsonTree(Object) + instead. +

+

+
Parameters:
src - the object for which JSON representation is to be created
typeOfSrc - The specific genericized type of src. You can obtain + this type by using the TypeToken class. For example, + to get the type for Collection<Foo>, you should use: +
+ Type typeOfSrc = new TypeToken<Collection<Foo>>(){}.getType();
+ 
+
Returns:
Json representation of src
Since:
+
1.4
+
+
+
+
+ +

+toJson

+
+public String toJson(Object src)
+
+
This method serializes the specified object into its equivalent Json representation. + This method should be used when the specified object is not a generic type. This method uses + Object.getClass() to get the type for the specified object, but the + getClass() loses the generic type information because of the Type Erasure feature + of Java. Note that this method works fine if the any of the object fields are of generic type, + just the object itself should not be of a generic type. If the object is of generic type, use + toJson(Object, Type) instead. If you want to write out the object to a + Writer, use toJson(Object, Appendable) instead. +

+

+
Parameters:
src - the object for which Json representation is to be created setting for Gson +
Returns:
Json representation of src.
+
+
+
+ +

+toJson

+
+public String toJson(Object src,
+                     Type typeOfSrc)
+
+
This method serializes the specified object, including those of generic types, into its + equivalent Json representation. This method must be used if the specified object is a generic + type. For non-generic objects, use toJson(Object) instead. If you want to write out + the object to a Appendable, use toJson(Object, Type, Appendable) instead. +

+

+
Parameters:
src - the object for which JSON representation is to be created
typeOfSrc - The specific genericized type of src. You can obtain + this type by using the TypeToken class. For example, + to get the type for Collection<Foo>, you should use: +
+ Type typeOfSrc = new TypeToken<Collection<Foo>>(){}.getType();
+ 
+
Returns:
Json representation of src
+
+
+
+ +

+toJson

+
+public void toJson(Object src,
+                   Appendable writer)
+            throws JsonIOException
+
+
This method serializes the specified object into its equivalent Json representation. + This method should be used when the specified object is not a generic type. This method uses + Object.getClass() to get the type for the specified object, but the + getClass() loses the generic type information because of the Type Erasure feature + of Java. Note that this method works fine if the any of the object fields are of generic type, + just the object itself should not be of a generic type. If the object is of generic type, use + toJson(Object, Type, Appendable) instead. +

+

+
Parameters:
src - the object for which Json representation is to be created setting for Gson
writer - Writer to which the Json representation needs to be written +
Throws: +
JsonIOException - if there was a problem writing to the writer
Since:
+
1.2
+
+
+
+
+ +

+toJson

+
+public void toJson(Object src,
+                   Type typeOfSrc,
+                   Appendable writer)
+            throws JsonIOException
+
+
This method serializes the specified object, including those of generic types, into its + equivalent Json representation. This method must be used if the specified object is a generic + type. For non-generic objects, use toJson(Object, Appendable) instead. +

+

+
Parameters:
src - the object for which JSON representation is to be created
typeOfSrc - The specific genericized type of src. You can obtain + this type by using the TypeToken class. For example, + to get the type for Collection<Foo>, you should use: +
+ Type typeOfSrc = new TypeToken<Collection<Foo>>(){}.getType();
+ 
writer - Writer to which the Json representation of src needs to be written. +
Throws: +
JsonIOException - if there was a problem writing to the writer
Since:
+
1.2
+
+
+
+
+ +

+toJson

+
+public void toJson(Object src,
+                   Type typeOfSrc,
+                   JsonWriter writer)
+            throws JsonIOException
+
+
Writes the JSON representation of src of type typeOfSrc to + writer. +

+

+ +
Throws: +
JsonIOException - if there was a problem writing to the writer
+
+
+
+ +

+toJson

+
+public String toJson(JsonElement jsonElement)
+
+
Converts a tree of JsonElements into its equivalent JSON representation. +

+

+
Parameters:
jsonElement - root of a tree of JsonElements +
Returns:
JSON String representation of the tree
Since:
+
1.4
+
+
+
+
+ +

+toJson

+
+public void toJson(JsonElement jsonElement,
+                   Appendable writer)
+            throws JsonIOException
+
+
Writes out the equivalent JSON for a tree of JsonElements. +

+

+
Parameters:
jsonElement - root of a tree of JsonElements
writer - Writer to which the Json representation needs to be written +
Throws: +
JsonIOException - if there was a problem writing to the writer
Since:
+
1.4
+
+
+
+
+ +

+toJson

+
+public void toJson(JsonElement jsonElement,
+                   JsonWriter writer)
+            throws JsonIOException
+
+
Writes the JSON for jsonElement to writer. +

+

+ +
Throws: +
JsonIOException - if there was a problem writing to the writer
+
+
+
+ +

+fromJson

+
+public <T> T fromJson(String json,
+                      Class<T> classOfT)
+           throws JsonSyntaxException
+
+
This method deserializes the specified Json into an object of the specified class. It is not + suitable to use if the specified class is a generic type since it will not have the generic + type information because of the Type Erasure feature of Java. Therefore, this method should not + be used if the desired type is a generic type. Note that this method works fine if the any of + the fields of the specified object are generics, just the object itself should not be a + generic type. For the cases when the object is of generic type, invoke + fromJson(String, Type). If you have the Json in a Reader instead of + a String, use fromJson(Reader, Class) instead. +

+

+
Type Parameters:
T - the type of the desired object
Parameters:
json - the string from which the object is to be deserialized
classOfT - the class of T +
Returns:
an object of type T from the string +
Throws: +
JsonSyntaxException - if json is not a valid representation for an object of type + classOfT
+
+
+
+ +

+fromJson

+
+public <T> T fromJson(String json,
+                      Type typeOfT)
+           throws JsonSyntaxException
+
+
This method deserializes the specified Json into an object of the specified type. This method + is useful if the specified object is a generic type. For non-generic objects, use + fromJson(String, Class) instead. If you have the Json in a Reader instead of + a String, use fromJson(Reader, Type) instead. +

+

+
Type Parameters:
T - the type of the desired object
Parameters:
json - the string from which the object is to be deserialized
typeOfT - The specific genericized type of src. You can obtain this type by using the + TypeToken class. For example, to get the type for + Collection<Foo>, you should use: +
+ Type typeOfT = new TypeToken<Collection<Foo>>(){}.getType();
+ 
+
Returns:
an object of type T from the string +
Throws: +
JsonParseException - if json is not a valid representation for an object of type typeOfT +
JsonSyntaxException - if json is not a valid representation for an object of type
+
+
+
+ +

+fromJson

+
+public <T> T fromJson(Reader json,
+                      Class<T> classOfT)
+           throws JsonSyntaxException,
+                  JsonIOException
+
+
This method deserializes the Json read from the specified reader into an object of the + specified class. It is not suitable to use if the specified class is a generic type since it + will not have the generic type information because of the Type Erasure feature of Java. + Therefore, this method should not be used if the desired type is a generic type. Note that + this method works fine if the any of the fields of the specified object are generics, just the + object itself should not be a generic type. For the cases when the object is of generic type, + invoke fromJson(Reader, Type). If you have the Json in a String form instead of a + Reader, use fromJson(String, Class) instead. +

+

+
Type Parameters:
T - the type of the desired object
Parameters:
json - the reader producing the Json from which the object is to be deserialized.
classOfT - the class of T +
Returns:
an object of type T from the string +
Throws: +
JsonIOException - if there was a problem reading from the Reader +
JsonSyntaxException - if json is not a valid representation for an object of type
Since:
+
1.2
+
+
+
+
+ +

+fromJson

+
+public <T> T fromJson(Reader json,
+                      Type typeOfT)
+           throws JsonIOException,
+                  JsonSyntaxException
+
+
This method deserializes the Json read from the specified reader into an object of the + specified type. This method is useful if the specified object is a generic type. For + non-generic objects, use fromJson(Reader, Class) instead. If you have the Json in a + String form instead of a Reader, use fromJson(String, Type) instead. +

+

+
Type Parameters:
T - the type of the desired object
Parameters:
json - the reader producing Json from which the object is to be deserialized
typeOfT - The specific genericized type of src. You can obtain this type by using the + TypeToken class. For example, to get the type for + Collection<Foo>, you should use: +
+ Type typeOfT = new TypeToken<Collection<Foo>>(){}.getType();
+ 
+
Returns:
an object of type T from the json +
Throws: +
JsonIOException - if there was a problem reading from the Reader +
JsonSyntaxException - if json is not a valid representation for an object of type
Since:
+
1.2
+
+
+
+
+ +

+fromJson

+
+public <T> T fromJson(JsonReader reader,
+                      Type typeOfT)
+           throws JsonIOException,
+                  JsonSyntaxException
+
+
Reads the next JSON value from reader and convert it to an object + of type typeOfT. + Since Type is not parameterized by T, this method is type unsafe and should be used carefully +

+

+ +
Throws: +
JsonIOException - if there was a problem writing to the Reader +
JsonSyntaxException - if json is not a valid representation for an object of type
+
+
+
+ +

+fromJson

+
+public <T> T fromJson(JsonElement json,
+                      Class<T> classOfT)
+           throws JsonSyntaxException
+
+
This method deserializes the Json read from the specified parse tree into an object of the + specified type. It is not suitable to use if the specified class is a generic type since it + will not have the generic type information because of the Type Erasure feature of Java. + Therefore, this method should not be used if the desired type is a generic type. Note that + this method works fine if the any of the fields of the specified object are generics, just the + object itself should not be a generic type. For the cases when the object is of generic type, + invoke fromJson(JsonElement, Type). +

+

+
Type Parameters:
T - the type of the desired object
Parameters:
json - the root of the parse tree of JsonElements from which the object is to + be deserialized
classOfT - The class of T +
Returns:
an object of type T from the json +
Throws: +
JsonSyntaxException - if json is not a valid representation for an object of type typeOfT
Since:
+
1.3
+
+
+
+
+ +

+fromJson

+
+public <T> T fromJson(JsonElement json,
+                      Type typeOfT)
+           throws JsonSyntaxException
+
+
This method deserializes the Json read from the specified parse tree into an object of the + specified type. This method is useful if the specified object is a generic type. For + non-generic objects, use fromJson(JsonElement, Class) instead. +

+

+
Type Parameters:
T - the type of the desired object
Parameters:
json - the root of the parse tree of JsonElements from which the object is to + be deserialized
typeOfT - The specific genericized type of src. You can obtain this type by using the + TypeToken class. For example, to get the type for + Collection<Foo>, you should use: +
+ Type typeOfT = new TypeToken<Collection<Foo>>(){}.getType();
+ 
+
Returns:
an object of type T from the json +
Throws: +
JsonSyntaxException - if json is not a valid representation for an object of type typeOfT
Since:
+
1.3
+
+
+
+
+ +

+toString

+
+public String toString()
+
+
+
Overrides:
toString in class Object
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/GsonBuilder.html b/gson/docs/javadocs/com/google/gson/GsonBuilder.html new file mode 100644 index 00000000..e1cd3da5 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/GsonBuilder.html @@ -0,0 +1,757 @@ + + + + + + + +GsonBuilder (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson +
+Class GsonBuilder

+
+java.lang.Object
+  extended by com.google.gson.GsonBuilder
+
+
+
+
public final class GsonBuilder
extends Object
+ + +

+

Use this builder to construct a Gson instance when you need to set configuration + options other than the default. For Gson with default configuration, it is simpler to + use new Gson(). GsonBuilder is best used by creating it, and then invoking its + various configuration methods, and finally calling create.

+ +

The following is an example shows how to use the GsonBuilder to construct a Gson + instance: + +

+ Gson gson = new GsonBuilder()
+     .registerTypeAdapter(Id.class, new IdTypeAdapter())
+     .serializeNulls()
+     .setDateFormat(DateFormat.LONG)
+     .setFieldNamingPolicy(FieldNamingPolicy.UPPER_CAMEL_CASE)
+     .setPrettyPrinting()
+     .setVersion(1.0)
+     .create();
+ 

+ +

NOTE: the order of invocation of configuration methods does not matter.

+

+ +

+

+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
GsonBuilder() + +
+          Creates a GsonBuilder instance that can be used to build Gson with various configuration + settings.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ Gsoncreate() + +
+          Creates a Gson instance based on the current configuration.
+ GsonBuilderdisableHtmlEscaping() + +
+          By default, Gson escapes HTML characters such as < > etc.
+ GsonBuilderdisableInnerClassSerialization() + +
+          Configures Gson to exclude inner classes during serialization.
+ GsonBuilderexcludeFieldsWithModifiers(int... modifiers) + +
+          Configures Gson to excludes all class fields that have the specified modifiers.
+ GsonBuilderexcludeFieldsWithoutExposeAnnotation() + +
+          Configures Gson to exclude all fields from consideration for serialization or deserialization + that do not have the Expose annotation.
+ GsonBuildergenerateNonExecutableJson() + +
+          Makes the output JSON non-executable in Javascript by prefixing the generated JSON with some + special text.
+ GsonBuilderregisterTypeAdapter(Type type, + Object typeAdapter) + +
+          Configures Gson for custom serialization or deserialization.
+ GsonBuilderserializeNulls() + +
+          Configure Gson to serialize null fields.
+ GsonBuilderserializeSpecialFloatingPointValues() + +
+          Section 2.4 of JSON specification disallows + special double values (NaN, Infinity, -Infinity).
+ GsonBuildersetDateFormat(int style) + +
+          Configures Gson to to serialize Date objects according to the style value provided.
+ GsonBuildersetDateFormat(int dateStyle, + int timeStyle) + +
+          Configures Gson to to serialize Date objects according to the style value provided.
+ GsonBuildersetDateFormat(String pattern) + +
+          Configures Gson to serialize Date objects according to the pattern provided.
+ GsonBuildersetExclusionStrategies(ExclusionStrategy... strategies) + +
+          Configures Gson to apply a set of exclusion strategies during both serialization and + deserialization.
+ GsonBuildersetFieldNamingPolicy(FieldNamingPolicy namingConvention) + +
+          Configures Gson to apply a specific naming policy to an object's field during serialization + and deserialization.
+ GsonBuildersetFieldNamingStrategy(FieldNamingStrategy fieldNamingStrategy) + +
+          Configures Gson to apply a specific naming policy strategy to an object's field during + serialization and deserialization.
+ GsonBuildersetLongSerializationPolicy(LongSerializationPolicy serializationPolicy) + +
+          Configures Gson to apply a specific serialization policy for Long and long + objects.
+ GsonBuildersetPrettyPrinting() + +
+          Configures Gson to output Json that fits in a page for pretty printing.
+ GsonBuildersetVersion(double ignoreVersionsAfter) + +
+          Configures Gson to enable versioning support.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+GsonBuilder

+
+public GsonBuilder()
+
+
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 + create(). +

+

+ + + + + + + + +
+Method Detail
+ +

+setVersion

+
+public GsonBuilder setVersion(double ignoreVersionsAfter)
+
+
Configures Gson to enable versioning support. +

+

+
Parameters:
ignoreVersionsAfter - any field or type marked with a version higher than this value + are ignored during serialization or deserialization. +
Returns:
a reference to this GsonBuilder object to fulfill the "Builder" pattern
+
+
+
+ +

+excludeFieldsWithModifiers

+
+public GsonBuilder excludeFieldsWithModifiers(int... modifiers)
+
+
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. +

+

+
Parameters:
modifiers - the field modifiers. You must use the modifiers specified in the + Modifier class. For example, + Modifier.TRANSIENT, + Modifier.STATIC. +
Returns:
a reference to this GsonBuilder object to fulfill the "Builder" pattern
+
+
+
+ +

+generateNonExecutableJson

+
+public GsonBuilder generateNonExecutableJson()
+
+
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 + Gson Issue 42 + for details. +

+

+ +
Returns:
a reference to this GsonBuilder object to fulfill the "Builder" pattern
Since:
+
1.3
+
+
+
+
+ +

+excludeFieldsWithoutExposeAnnotation

+
+public GsonBuilder excludeFieldsWithoutExposeAnnotation()
+
+
Configures Gson to exclude all fields from consideration for serialization or deserialization + that do not have the Expose annotation. +

+

+ +
Returns:
a reference to this GsonBuilder object to fulfill the "Builder" pattern
+
+
+
+ +

+serializeNulls

+
+public GsonBuilder serializeNulls()
+
+
Configure Gson to serialize null fields. By default, Gson omits all fields that are null + during serialization. +

+

+ +
Returns:
a reference to this GsonBuilder object to fulfill the "Builder" pattern
Since:
+
1.2
+
+
+
+
+ +

+disableInnerClassSerialization

+
+public GsonBuilder disableInnerClassSerialization()
+
+
Configures Gson to exclude inner classes during serialization. +

+

+ +
Returns:
a reference to this GsonBuilder object to fulfill the "Builder" pattern
Since:
+
1.3
+
+
+
+
+ +

+setLongSerializationPolicy

+
+public GsonBuilder setLongSerializationPolicy(LongSerializationPolicy serializationPolicy)
+
+
Configures Gson to apply a specific serialization policy for Long and long + objects. +

+

+
Parameters:
serializationPolicy - the particular policy to use for serializing longs. +
Returns:
a reference to this GsonBuilder object to fulfill the "Builder" pattern
Since:
+
1.3
+
+
+
+
+ +

+setFieldNamingPolicy

+
+public GsonBuilder setFieldNamingPolicy(FieldNamingPolicy namingConvention)
+
+
Configures Gson to apply a specific naming policy to an object's field during serialization + and deserialization. +

+

+
Parameters:
namingConvention - the JSON field naming convention to use for serialization and + deserialization. +
Returns:
a reference to this GsonBuilder object to fulfill the "Builder" pattern
+
+
+
+ +

+setFieldNamingStrategy

+
+public GsonBuilder setFieldNamingStrategy(FieldNamingStrategy fieldNamingStrategy)
+
+
Configures Gson to apply a specific naming policy strategy to an object's field during + serialization and deserialization. +

+

+
Parameters:
fieldNamingStrategy - the actual naming strategy to apply to the fields +
Returns:
a reference to this GsonBuilder object to fulfill the "Builder" pattern
Since:
+
1.3
+
+
+
+
+ +

+setExclusionStrategies

+
+public GsonBuilder setExclusionStrategies(ExclusionStrategy... strategies)
+
+
Configures Gson to apply a set of exclusion strategies during both serialization and + deserialization. Each of the strategies will be applied as a disjunction rule. + This means that if one of the strategies suggests that a field (or class) should be + skipped then that field (or object) is skipped during serializaiton/deserialization. +

+

+
Parameters:
strategies - the set of strategy object to apply during object (de)serialization. +
Returns:
a reference to this GsonBuilder object to fulfill the "Builder" pattern
Since:
+
1.4
+
+
+
+
+ +

+setPrettyPrinting

+
+public GsonBuilder setPrettyPrinting()
+
+
Configures Gson to output Json that fits in a page for pretty printing. This option only + affects Json serialization. +

+

+ +
Returns:
a reference to this GsonBuilder object to fulfill the "Builder" pattern
+
+
+
+ +

+disableHtmlEscaping

+
+public GsonBuilder disableHtmlEscaping()
+
+
By default, Gson escapes HTML characters such as < > etc. Use this option to configure + Gson to pass-through HTML characters as is. +

+

+ +
Returns:
a reference to this GsonBuilder object to fulfill the "Builder" pattern
Since:
+
1.3
+
+
+
+
+ +

+setDateFormat

+
+public GsonBuilder setDateFormat(String pattern)
+
+
Configures Gson to serialize Date objects according to the pattern provided. You can + call this method or setDateFormat(int) multiple times, but only the last invocation + will be used to decide the serialization format. + +

Note that this pattern must abide by the convention provided by SimpleDateFormat + class. See the documentation in SimpleDateFormat for more information on + valid date and time patterns.

+

+

+
Parameters:
pattern - the pattern that dates will be serialized/deserialized to/from +
Returns:
a reference to this GsonBuilder object to fulfill the "Builder" pattern
Since:
+
1.2
+
+
+
+
+ +

+setDateFormat

+
+public GsonBuilder setDateFormat(int style)
+
+
Configures Gson to to serialize Date objects according to the style value provided. + You can call this method or setDateFormat(String) multiple times, but only the last + invocation will be used to decide the serialization format. + +

Note that this style value should be one of the predefined constants in the + DateFormat class. See the documentation in DateFormat for more + information on the valid style constants.

+

+

+
Parameters:
style - the predefined date style that date objects will be serialized/deserialized + to/from +
Returns:
a reference to this GsonBuilder object to fulfill the "Builder" pattern
Since:
+
1.2
+
+
+
+
+ +

+setDateFormat

+
+public GsonBuilder setDateFormat(int dateStyle,
+                                 int timeStyle)
+
+
Configures Gson to to serialize Date objects according to the style value provided. + You can call this method or setDateFormat(String) multiple times, but only the last + invocation will be used to decide the serialization format. + +

Note that this style value should be one of the predefined constants in the + DateFormat class. See the documentation in DateFormat for more + information on the valid style constants.

+

+

+
Parameters:
dateStyle - the predefined date style that date objects will be serialized/deserialized + to/from
timeStyle - the predefined style for the time portion of the date objects +
Returns:
a reference to this GsonBuilder object to fulfill the "Builder" pattern
Since:
+
1.2
+
+
+
+
+ +

+registerTypeAdapter

+
+public GsonBuilder registerTypeAdapter(Type type,
+                                       Object typeAdapter)
+
+
Configures Gson for custom serialization or deserialization. This method combines the + registration of an InstanceCreator, JsonSerializer, and a + JsonDeserializer. It is best used when a single object typeAdapter implements + all the required interfaces for custom serialization with Gson. If an instance creator, + serializer or deserializer was previously registered for the specified type, it is + overwritten. +

+

+
Parameters:
type - the type definition for the type adapter being registered
typeAdapter - This object must implement at least one of the InstanceCreator, + JsonSerializer, and a JsonDeserializer interfaces. +
Returns:
a reference to this GsonBuilder object to fulfill the "Builder" pattern
+
+
+
+ +

+serializeSpecialFloatingPointValues

+
+public GsonBuilder serializeSpecialFloatingPointValues()
+
+
Section 2.4 of JSON specification disallows + special double values (NaN, Infinity, -Infinity). However, + Javascript + specification (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. + +

Gson always accepts these special values during deserialization. However, it outputs + strictly compliant JSON. Hence, if it encounters a float value Float.NaN, + Float.POSITIVE_INFINITY, Float.NEGATIVE_INFINITY, or a double value + Double.NaN, Double.POSITIVE_INFINITY, Double.NEGATIVE_INFINITY, it + will throw an IllegalArgumentException. 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. +

+

+ +
Returns:
a reference to this GsonBuilder object to fulfill the "Builder" pattern
Since:
+
1.3
+
+
+
+
+ +

+create

+
+public Gson create()
+
+
Creates a Gson instance based on the current configuration. This method is free of + side-effects to this GsonBuilder instance and hence can be called multiple times. +

+

+ +
Returns:
an instance of Gson configured with the options currently set in this builder
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/InstanceCreator.html b/gson/docs/javadocs/com/google/gson/InstanceCreator.html new file mode 100644 index 00000000..d94fed47 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/InstanceCreator.html @@ -0,0 +1,275 @@ + + + + + + + +InstanceCreator (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson +
+Interface InstanceCreator<T>

+
+
Type Parameters:
T - the type of object that will be created by this implementation.
+
+
+
public interface InstanceCreator<T>
+ + +

+This interface is implemented to create instances of a class that does not define a no-args + constructor. If you can modify the class, you should instead add a private, or public + no-args constructor. However, that is not possible for library classes, such as JDK classes, or + a third-party library that you do not have source-code of. In such cases, you should define an + instance creator for the class. Implementations of this interface should be registered with + GsonBuilder.registerTypeAdapter(Type, Object) method before Gson will be able to use + them. +

Let us look at an example where defining an InstanceCreator might be useful. The + Id class defined below does not have a default no-args constructor.

+ +
+ public class Id<T> {
+   private final Class<T> clazz;
+   private final long value;
+   public Id(Class<T> clazz, long value) {
+     this.clazz = clazz;
+     this.value = value;
+   }
+ }
+ 
+ +

If Gson encounters an object of type Id during deserialization, it will throw an + exception. The easiest way to solve this problem will be to add a (public or private) no-args + constructor as follows:

+ +
+ private Id() {
+   this(Object.class, 0L);
+ }
+ 
+ +

However, let us assume that the developer does not have access to the source-code of the + Id class, or does not want to define a no-args constructor for it. The developer + can solve this problem by defining an InstanceCreator for Id:

+ +
+ class IdInstanceCreator implements InstanceCreator<Id> {
+   public Id createInstance(Type type) {
+     return new Id(Object.class, 0L);
+   }
+ }
+ 
+ +

Note that it does not matter what the fields of the created instance contain since Gson will + overwrite them with the deserialized values specified in Json. You should also ensure that a + new object is returned, not a common object since its fields will be overwritten. + The developer will need to register IdInstanceCreator with Gson as follows:

+ +
+ Gson gson = new GsonBuilder().registerTypeAdapter(Id.class, new IdInstanceCreator()).create();
+ 
+

+ +

+

+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ +

+ + + + + + + + + + + + +
+Method Summary
+ TcreateInstance(Type type) + +
+          Gson invokes this call-back method during deserialization to create an instance of the + specified type.
+  +

+ + + + + + + + +
+Method Detail
+ +

+createInstance

+
+T createInstance(Type type)
+
+
Gson invokes this call-back method during deserialization to create an instance of the + specified type. The fields of the returned instance are overwritten with the data present + in the Json. Since the prior contents of the object are destroyed and overwritten, do not + return an instance that is useful elsewhere. In particular, do not return a common instance, + always use new to create a new instance. +

+

+
Parameters:
type - the parameterized T represented as a Type. +
Returns:
a default object instance of type T.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/JsonArray.html b/gson/docs/javadocs/com/google/gson/JsonArray.html new file mode 100644 index 00000000..477ae963 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/JsonArray.html @@ -0,0 +1,732 @@ + + + + + + + +JsonArray (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson +
+Class JsonArray

+
+java.lang.Object
+  extended by com.google.gson.JsonElement
+      extended by com.google.gson.JsonArray
+
+
+
All Implemented Interfaces:
Iterable<JsonElement>
+
+
+
+
public final class JsonArray
extends JsonElement
implements Iterable<JsonElement>
+ + +

+A class representing an array type in Json. An array is a list of JsonElements 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. +

+ +

+

+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
JsonArray() + +
+          Creates an empty JsonArray.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidadd(JsonElement element) + +
+          Adds the specified element to self.
+ voidaddAll(JsonArray array) + +
+          Adds all the elements of the specified array to self.
+ JsonElementget(int i) + +
+          Returns the ith element of the array.
+ BigDecimalgetAsBigDecimal() + +
+          convenience method to get this array as a BigDecimal if it contains a single element.
+ BigIntegergetAsBigInteger() + +
+          convenience method to get this array as a BigInteger if it contains a single element.
+ booleangetAsBoolean() + +
+          convenience method to get this array as a boolean if it contains a single element.
+ bytegetAsByte() + +
+          convenience method to get this element as a primitive byte value.
+ chargetAsCharacter() + +
+          convenience method to get this element as a primitive character value.
+ doublegetAsDouble() + +
+          convenience method to get this array as a double if it contains a single element.
+ floatgetAsFloat() + +
+          convenience method to get this array as a float if it contains a single element.
+ intgetAsInt() + +
+          convenience method to get this array as an integer if it contains a single element.
+ longgetAsLong() + +
+          convenience method to get this array as a long if it contains a single element.
+ NumbergetAsNumber() + +
+          convenience method to get this array as a Number if it contains a single element.
+ shortgetAsShort() + +
+          convenience method to get this array as a primitive short if it contains a single element.
+ StringgetAsString() + +
+          convenience method to get this array as a String if it contains a single element.
+ Iterator<JsonElement>iterator() + +
+          Returns an iterator to navigate the elemetns of the array.
+ intsize() + +
+          Returns the number of elements in the array.
+ + + + + + + +
Methods inherited from class com.google.gson.JsonElement
getAsJsonArray, getAsJsonNull, getAsJsonObject, getAsJsonPrimitive, isJsonArray, isJsonNull, isJsonObject, isJsonPrimitive, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+JsonArray

+
+public JsonArray()
+
+
Creates an empty JsonArray. +

+

+ + + + + + + + +
+Method Detail
+ +

+add

+
+public void add(JsonElement element)
+
+
Adds the specified element to self. +

+

+
+
+
+
Parameters:
element - the element that needs to be added to the array.
+
+
+
+ +

+addAll

+
+public void addAll(JsonArray array)
+
+
Adds all the elements of the specified array to self. +

+

+
+
+
+
Parameters:
array - the array whose elements need to be added to the array.
+
+
+
+ +

+size

+
+public int size()
+
+
Returns the number of elements in the array. +

+

+
+
+
+ +
Returns:
the number of elements in the array.
+
+
+
+ +

+iterator

+
+public Iterator<JsonElement> iterator()
+
+
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. +

+

+
Specified by:
iterator in interface Iterable<JsonElement>
+
+
+ +
Returns:
an iterator to navigate the elements of the array.
+
+
+
+ +

+get

+
+public JsonElement get(int i)
+
+
Returns the ith element of the array. +

+

+
+
+
+
Parameters:
i - the index of the element that is being sought. +
Returns:
the element present at the ith index. +
Throws: +
IndexOutOfBoundsException - if i is negative or greater than or equal to the + size() of the array.
+
+
+
+ +

+getAsNumber

+
+public Number getAsNumber()
+
+
convenience method to get this array as a Number if it contains a single element. +

+

+
Overrides:
getAsNumber in class JsonElement
+
+
+ +
Returns:
get this element as a number if it is single element array. +
Throws: +
ClassCastException - if the element in the array is of not a JsonPrimitive and + is not a valid Number. +
IllegalStateException - if the array has more than one element.
+
+
+
+ +

+getAsString

+
+public String getAsString()
+
+
convenience method to get this array as a String if it contains a single element. +

+

+
Overrides:
getAsString in class JsonElement
+
+
+ +
Returns:
get this element as a String if it is single element array. +
Throws: +
ClassCastException - if the element in the array is of not a JsonPrimitive and + is not a valid String. +
IllegalStateException - if the array has more than one element.
+
+
+
+ +

+getAsDouble

+
+public double getAsDouble()
+
+
convenience method to get this array as a double if it contains a single element. +

+

+
Overrides:
getAsDouble in class JsonElement
+
+
+ +
Returns:
get this element as a double if it is single element array. +
Throws: +
ClassCastException - if the element in the array is of not a JsonPrimitive and + is not a valid double. +
IllegalStateException - if the array has more than one element.
+
+
+
+ +

+getAsBigDecimal

+
+public BigDecimal getAsBigDecimal()
+
+
convenience method to get this array as a BigDecimal if it contains a single element. +

+

+
Overrides:
getAsBigDecimal in class JsonElement
+
+
+ +
Returns:
get this element as a BigDecimal if it is single element array. +
Throws: +
ClassCastException - if the element in the array is of not a JsonPrimitive. +
NumberFormatException - if the element at index 0 is not a valid BigDecimal. +
IllegalStateException - if the array has more than one element.
Since:
+
1.2
+
+
+
+
+ +

+getAsBigInteger

+
+public BigInteger getAsBigInteger()
+
+
convenience method to get this array as a BigInteger if it contains a single element. +

+

+
Overrides:
getAsBigInteger in class JsonElement
+
+
+ +
Returns:
get this element as a BigInteger if it is single element array. +
Throws: +
ClassCastException - if the element in the array is of not a JsonPrimitive. +
NumberFormatException - if the element at index 0 is not a valid BigInteger. +
IllegalStateException - if the array has more than one element.
Since:
+
1.2
+
+
+
+
+ +

+getAsFloat

+
+public float getAsFloat()
+
+
convenience method to get this array as a float if it contains a single element. +

+

+
Overrides:
getAsFloat in class JsonElement
+
+
+ +
Returns:
get this element as a float if it is single element array. +
Throws: +
ClassCastException - if the element in the array is of not a JsonPrimitive and + is not a valid float. +
IllegalStateException - if the array has more than one element.
+
+
+
+ +

+getAsLong

+
+public long getAsLong()
+
+
convenience method to get this array as a long if it contains a single element. +

+

+
Overrides:
getAsLong in class JsonElement
+
+
+ +
Returns:
get this element as a long if it is single element array. +
Throws: +
ClassCastException - if the element in the array is of not a JsonPrimitive and + is not a valid long. +
IllegalStateException - if the array has more than one element.
+
+
+
+ +

+getAsInt

+
+public int getAsInt()
+
+
convenience method to get this array as an integer if it contains a single element. +

+

+
Overrides:
getAsInt in class JsonElement
+
+
+ +
Returns:
get this element as an integer if it is single element array. +
Throws: +
ClassCastException - if the element in the array is of not a JsonPrimitive and + is not a valid integer. +
IllegalStateException - if the array has more than one element.
+
+
+
+ +

+getAsByte

+
+public byte getAsByte()
+
+
Description copied from class: JsonElement
+
convenience method to get this element as a primitive byte value. +

+

+
Overrides:
getAsByte in class JsonElement
+
+
+ +
Returns:
get this element as a primitive byte value.
+
+
+
+ +

+getAsCharacter

+
+public char getAsCharacter()
+
+
Description copied from class: JsonElement
+
convenience method to get this element as a primitive character value. +

+

+
Overrides:
getAsCharacter in class JsonElement
+
+
+ +
Returns:
get this element as a primitive char value.
+
+
+
+ +

+getAsShort

+
+public short getAsShort()
+
+
convenience method to get this array as a primitive short if it contains a single element. +

+

+
Overrides:
getAsShort in class JsonElement
+
+
+ +
Returns:
get this element as a primitive short if it is single element array. +
Throws: +
ClassCastException - if the element in the array is of not a JsonPrimitive and + is not a valid short. +
IllegalStateException - if the array has more than one element.
+
+
+
+ +

+getAsBoolean

+
+public boolean getAsBoolean()
+
+
convenience method to get this array as a boolean if it contains a single element. +

+

+
Overrides:
getAsBoolean in class JsonElement
+
+
+ +
Returns:
get this element as a boolean if it is single element array. +
Throws: +
ClassCastException - if the element in the array is of not a JsonPrimitive and + is not a valid boolean. +
IllegalStateException - if the array has more than one element.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/JsonDeserializationContext.html b/gson/docs/javadocs/com/google/gson/JsonDeserializationContext.html new file mode 100644 index 00000000..935f0321 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/JsonDeserializationContext.html @@ -0,0 +1,235 @@ + + + + + + + +JsonDeserializationContext (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson +
+Interface JsonDeserializationContext

+
+
+
public interface JsonDeserializationContext
+ + +

+Context for deserialization that is passed to a custom deserializer during invocation of its + JsonDeserializer.deserialize(JsonElement, Type, JsonDeserializationContext) + method. +

+ +

+

+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ +

+ + + + + + + + + + + + +
+Method Summary
+ + + + + +
+<T> T
+
deserialize(JsonElement json, + Type typeOfT) + +
+          Invokes default deserialization on the specified object.
+  +

+ + + + + + + + +
+Method Detail
+ +

+deserialize

+
+<T> T deserialize(JsonElement json,
+                  Type typeOfT)
+              throws JsonParseException
+
+
Invokes default deserialization on the specified object. It should never be invoked on + the element received as a parameter of the + JsonDeserializer.deserialize(JsonElement, Type, JsonDeserializationContext) method. Doing + so will result in an infinite loop since Gson will in-turn call the custom deserializer again. +

+

+
Type Parameters:
T - The type of the deserialized object.
Parameters:
json - the parse tree.
typeOfT - type of the expected return value. +
Returns:
An object of type typeOfT. +
Throws: +
JsonParseException - if the parse tree does not contain expected data.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/JsonDeserializer.html b/gson/docs/javadocs/com/google/gson/JsonDeserializer.html new file mode 100644 index 00000000..83723386 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/JsonDeserializer.html @@ -0,0 +1,275 @@ + + + + + + + +JsonDeserializer (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson +
+Interface JsonDeserializer<T>

+
+
Type Parameters:
T - type for which the deserializer is being registered. It is possible that a + deserializer may be asked to deserialize a specific generic type of the T.
+
+
+
public interface JsonDeserializer<T>
+ + +

+

Interface representing a custom deserializer for Json. You should write a custom + deserializer, if you are not happy with the default deserialization done by Gson. You will + also need to register this deserializer through + GsonBuilder.registerTypeAdapter(Type, Object).

+ +

Let us look at example where defining a deserializer will be useful. The Id class + defined below has two fields: clazz and value.

+ +
+ public class Id<T> {
+   private final Class<T> clazz;
+   private final long value;
+   public Id(Class<T> clazz, long value) {
+     this.clazz = clazz;
+     this.value = value;
+   }
+   public long getValue() {
+     return value;
+   }
+ }
+ 
+ +

The default deserialization of Id(com.foo.MyObject.class, 20L) will require the + Json string to be {"clazz":com.foo.MyObject,"value":20}. Suppose, you already know + the type of the field that the Id will be deserialized into, and hence just want to + deserialize it from a Json string 20. You can achieve that by writing a custom + deserializer:

+ +
+ class IdDeserializer implements JsonDeserializer<Id>() {
+   public Id fromJson(JsonElement json, Type typeOfT, JsonDeserializationContext context)
+       throws JsonParseException {
+     return (Id) new Id((Class)typeOfT, id.getValue());
+   }
+ 
+ +

You will also need to register IdDeserializer with Gson as follows:

+ +
+ Gson gson = new GsonBuilder().registerTypeAdapter(Id.class, new IdDeserializer()).create();
+ 
+

+ +

+

+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ +

+ + + + + + + + + + + + +
+Method Summary
+ Tdeserialize(JsonElement json, + Type typeOfT, + JsonDeserializationContext context) + +
+          Gson invokes this call-back method during deserialization when it encounters a field of the + specified type.
+  +

+ + + + + + + + +
+Method Detail
+ +

+deserialize

+
+T deserialize(JsonElement json,
+              Type typeOfT,
+              JsonDeserializationContext context)
+              throws JsonParseException
+
+
Gson invokes this call-back method during deserialization when it encounters a field of the + specified type. +

In the implementation of this call-back method, you should consider invoking + JsonDeserializationContext.deserialize(JsonElement, Type) method to create objects + for any non-trivial field of the returned object. However, you should never invoke it on the + the same type passing json since that will cause an infinite loop (Gson will call your + call-back method again). +

+

+
Parameters:
json - The Json data being deserialized
typeOfT - The type of the Object to deserialize to +
Returns:
a deserialized object of the specified type typeOfT which is a subclass of T +
Throws: +
JsonParseException - if json is not in the expected format of typeofT
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/JsonElement.html b/gson/docs/javadocs/com/google/gson/JsonElement.html new file mode 100644 index 00000000..896a9d57 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/JsonElement.html @@ -0,0 +1,803 @@ + + + + + + + +JsonElement (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson +
+Class JsonElement

+
+java.lang.Object
+  extended by com.google.gson.JsonElement
+
+
+
Direct Known Subclasses:
JsonArray, JsonNull, JsonObject, JsonPrimitive
+
+
+
+
public abstract class JsonElement
extends Object
+ + +

+A class representing an element of Json. It could either be a JsonObject, a + JsonArray, a JsonPrimitive or a JsonNull. +

+ +

+

+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
JsonElement() + +
+           
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ BigDecimalgetAsBigDecimal() + +
+          convenience method to get this element as a BigDecimal.
+ BigIntegergetAsBigInteger() + +
+          convenience method to get this element as a BigInteger.
+ booleangetAsBoolean() + +
+          convenience method to get this element as a boolean value.
+ bytegetAsByte() + +
+          convenience method to get this element as a primitive byte value.
+ chargetAsCharacter() + +
+          convenience method to get this element as a primitive character value.
+ doublegetAsDouble() + +
+          convenience method to get this element as a primitive double value.
+ floatgetAsFloat() + +
+          convenience method to get this element as a primitive float value.
+ intgetAsInt() + +
+          convenience method to get this element as a primitive integer value.
+ JsonArraygetAsJsonArray() + +
+          convenience method to get this element as a JsonArray.
+ JsonNullgetAsJsonNull() + +
+          convenience method to get this element as a JsonNull.
+ JsonObjectgetAsJsonObject() + +
+          convenience method to get this element as a JsonObject.
+ JsonPrimitivegetAsJsonPrimitive() + +
+          convenience method to get this element as a JsonPrimitive.
+ longgetAsLong() + +
+          convenience method to get this element as a primitive long value.
+ NumbergetAsNumber() + +
+          convenience method to get this element as a Number.
+ shortgetAsShort() + +
+          convenience method to get this element as a primitive short value.
+ StringgetAsString() + +
+          convenience method to get this element as a string value.
+ booleanisJsonArray() + +
+          provides check for verifying if this element is an array or not.
+ booleanisJsonNull() + +
+          provides check for verifying if this element represents a null value or not.
+ booleanisJsonObject() + +
+          provides check for verifying if this element is a Json object or not.
+ booleanisJsonPrimitive() + +
+          provides check for verifying if this element is a primitive or not.
+ StringtoString() + +
+          Returns a String representation of this element.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+JsonElement

+
+public JsonElement()
+
+
+ + + + + + + + +
+Method Detail
+ +

+isJsonArray

+
+public boolean isJsonArray()
+
+
provides check for verifying if this element is an array or not. +

+

+ +
Returns:
true if this element is of type JsonArray, false otherwise.
+
+
+
+ +

+isJsonObject

+
+public boolean isJsonObject()
+
+
provides check for verifying if this element is a Json object or not. +

+

+ +
Returns:
true if this element is of type JsonObject, false otherwise.
+
+
+
+ +

+isJsonPrimitive

+
+public boolean isJsonPrimitive()
+
+
provides check for verifying if this element is a primitive or not. +

+

+ +
Returns:
true if this element is of type JsonPrimitive, false otherwise.
+
+
+
+ +

+isJsonNull

+
+public boolean isJsonNull()
+
+
provides check for verifying if this element represents a null value or not. +

+

+ +
Returns:
true if this element is of type JsonNull, false otherwise.
Since:
+
1.2
+
+
+
+
+ +

+getAsJsonObject

+
+public JsonObject getAsJsonObject()
+
+
convenience method to get this element as a JsonObject. If the element is of some + other type, a ClassCastException will result. Hence it is best to use this method + after ensuring that this element is of the desired type by calling isJsonObject() + first. +

+

+ +
Returns:
get this element as a JsonObject. +
Throws: +
IllegalStateException - if the element is of another type.
+
+
+
+ +

+getAsJsonArray

+
+public JsonArray getAsJsonArray()
+
+
convenience method to get this element as a JsonArray. If the element is of some + other type, a ClassCastException will result. Hence it is best to use this method + after ensuring that this element is of the desired type by calling isJsonArray() + first. +

+

+ +
Returns:
get this element as a JsonArray. +
Throws: +
IllegalStateException - if the element is of another type.
+
+
+
+ +

+getAsJsonPrimitive

+
+public JsonPrimitive getAsJsonPrimitive()
+
+
convenience method to get this element as a JsonPrimitive. If the element is of some + other type, a ClassCastException will result. Hence it is best to use this method + after ensuring that this element is of the desired type by calling isJsonPrimitive() + first. +

+

+ +
Returns:
get this element as a JsonPrimitive. +
Throws: +
IllegalStateException - if the element is of another type.
+
+
+
+ +

+getAsJsonNull

+
+public JsonNull getAsJsonNull()
+
+
convenience method to get this element as a JsonNull. If the element is of some + other type, a ClassCastException will result. Hence it is best to use this method + after ensuring that this element is of the desired type by calling isJsonNull() + first. +

+

+ +
Returns:
get this element as a JsonNull. +
Throws: +
IllegalStateException - if the element is of another type.
Since:
+
1.2
+
+
+
+
+ +

+getAsBoolean

+
+public boolean getAsBoolean()
+
+
convenience method to get this element as a boolean value. +

+

+ +
Returns:
get this element as a primitive boolean value. +
Throws: +
ClassCastException - if the element is of not a JsonPrimitive and is not a valid + boolean value. +
IllegalStateException - if the element is of the type JsonArray but contains + more than a single element.
+
+
+
+ +

+getAsNumber

+
+public Number getAsNumber()
+
+
convenience method to get this element as a Number. +

+

+ +
Returns:
get this element as a Number. +
Throws: +
ClassCastException - if the element is of not a JsonPrimitive and is not a valid + number. +
IllegalStateException - if the element is of the type JsonArray but contains + more than a single element.
+
+
+
+ +

+getAsString

+
+public String getAsString()
+
+
convenience method to get this element as a string value. +

+

+ +
Returns:
get this element as a string value. +
Throws: +
ClassCastException - if the element is of not a JsonPrimitive and is not a valid + string value. +
IllegalStateException - if the element is of the type JsonArray but contains + more than a single element.
+
+
+
+ +

+getAsDouble

+
+public double getAsDouble()
+
+
convenience method to get this element as a primitive double value. +

+

+ +
Returns:
get this element as a primitive double value. +
Throws: +
ClassCastException - if the element is of not a JsonPrimitive and is not a valid + double value. +
IllegalStateException - if the element is of the type JsonArray but contains + more than a single element.
+
+
+
+ +

+getAsFloat

+
+public float getAsFloat()
+
+
convenience method to get this element as a primitive float value. +

+

+ +
Returns:
get this element as a primitive float value. +
Throws: +
ClassCastException - if the element is of not a JsonPrimitive and is not a valid + float value. +
IllegalStateException - if the element is of the type JsonArray but contains + more than a single element.
+
+
+
+ +

+getAsLong

+
+public long getAsLong()
+
+
convenience method to get this element as a primitive long value. +

+

+ +
Returns:
get this element as a primitive long value. +
Throws: +
ClassCastException - if the element is of not a JsonPrimitive and is not a valid + long value. +
IllegalStateException - if the element is of the type JsonArray but contains + more than a single element.
+
+
+
+ +

+getAsInt

+
+public int getAsInt()
+
+
convenience method to get this element as a primitive integer value. +

+

+ +
Returns:
get this element as a primitive integer value. +
Throws: +
ClassCastException - if the element is of not a JsonPrimitive and is not a valid + integer value. +
IllegalStateException - if the element is of the type JsonArray but contains + more than a single element.
+
+
+
+ +

+getAsByte

+
+public byte getAsByte()
+
+
convenience method to get this element as a primitive byte value. +

+

+ +
Returns:
get this element as a primitive byte value. +
Throws: +
ClassCastException - if the element is of not a JsonPrimitive and is not a valid + byte value. +
IllegalStateException - if the element is of the type JsonArray but contains + more than a single element.
Since:
+
1.3
+
+
+
+
+ +

+getAsCharacter

+
+public char getAsCharacter()
+
+
convenience method to get this element as a primitive character value. +

+

+ +
Returns:
get this element as a primitive char value. +
Throws: +
ClassCastException - if the element is of not a JsonPrimitive and is not a valid + char value. +
IllegalStateException - if the element is of the type JsonArray but contains + more than a single element.
Since:
+
1.3
+
+
+
+
+ +

+getAsBigDecimal

+
+public BigDecimal getAsBigDecimal()
+
+
convenience method to get this element as a BigDecimal. +

+

+ +
Returns:
get this element as a BigDecimal. +
Throws: +
ClassCastException - if the element is of not a JsonPrimitive. + * @throws NumberFormatException if the element is not a valid BigDecimal. +
IllegalStateException - if the element is of the type JsonArray but contains + more than a single element.
Since:
+
1.2
+
+
+
+
+ +

+getAsBigInteger

+
+public BigInteger getAsBigInteger()
+
+
convenience method to get this element as a BigInteger. +

+

+ +
Returns:
get this element as a BigInteger. +
Throws: +
ClassCastException - if the element is of not a JsonPrimitive. +
NumberFormatException - if the element is not a valid BigInteger. +
IllegalStateException - if the element is of the type JsonArray but contains + more than a single element.
Since:
+
1.2
+
+
+
+
+ +

+getAsShort

+
+public short getAsShort()
+
+
convenience method to get this element as a primitive short value. +

+

+ +
Returns:
get this element as a primitive short value. +
Throws: +
ClassCastException - if the element is of not a JsonPrimitive and is not a valid + short value. +
IllegalStateException - if the element is of the type JsonArray but contains + more than a single element.
+
+
+
+ +

+toString

+
+public String toString()
+
+
Returns a String representation of this element. +

+

+
Overrides:
toString in class Object
+
+
+ +
Returns:
String the string representation of this element.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/JsonIOException.html b/gson/docs/javadocs/com/google/gson/JsonIOException.html new file mode 100644 index 00000000..505aebea --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/JsonIOException.html @@ -0,0 +1,285 @@ + + + + + + + +JsonIOException (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson +
+Class JsonIOException

+
+java.lang.Object
+  extended by java.lang.Throwable
+      extended by java.lang.Exception
+          extended by java.lang.RuntimeException
+              extended by com.google.gson.JsonParseException
+                  extended by com.google.gson.JsonIOException
+
+
+
All Implemented Interfaces:
Serializable
+
+
+
+
public final class JsonIOException
extends JsonParseException
+ + +

+This exception is raised when Gson was unable to read an input stream + or write to one. +

+ +

+

+
Author:
+
Inderjeet Singh, Joel Leitch
+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + + + + + + + +
+Constructor Summary
JsonIOException(String msg) + +
+           
JsonIOException(String msg, + Throwable cause) + +
+           
JsonIOException(Throwable cause) + +
+          Creates exception with the specified cause.
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+JsonIOException

+
+public JsonIOException(String msg)
+
+
+
+ +

+JsonIOException

+
+public JsonIOException(String msg,
+                       Throwable cause)
+
+
+
+ +

+JsonIOException

+
+public JsonIOException(Throwable cause)
+
+
Creates exception with the specified cause. Consider using + JsonIOException(String, Throwable) instead if you can describe what happened. +

+

+
Parameters:
cause - root exception that caused this exception to be thrown.
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/JsonNull.html b/gson/docs/javadocs/com/google/gson/JsonNull.html new file mode 100644 index 00000000..3725b1c7 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/JsonNull.html @@ -0,0 +1,304 @@ + + + + + + + +JsonNull (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson +
+Class JsonNull

+
+java.lang.Object
+  extended by com.google.gson.JsonElement
+      extended by com.google.gson.JsonNull
+
+
+
+
public final class JsonNull
extends JsonElement
+ + +

+A class representing a Json null value. +

+ +

+

+
Since:
+
1.2
+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
JsonNull() + +
+          Creates a new JsonNull object.
+  + + + + + + + + + + + + + + + +
+Method Summary
+ booleanequals(Object other) + +
+          All instances of JsonNull are the same
+ inthashCode() + +
+          All instances of JsonNull have the same hash code since they are indistinguishable
+ + + + + + + +
Methods inherited from class com.google.gson.JsonElement
getAsBigDecimal, getAsBigInteger, getAsBoolean, getAsByte, getAsCharacter, getAsDouble, getAsFloat, getAsInt, getAsJsonArray, getAsJsonNull, getAsJsonObject, getAsJsonPrimitive, getAsLong, getAsNumber, getAsShort, getAsString, isJsonArray, isJsonNull, isJsonObject, isJsonPrimitive, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+JsonNull

+
+public JsonNull()
+
+
Creates a new JsonNull object. +

+

+ + + + + + + + +
+Method Detail
+ +

+hashCode

+
+public int hashCode()
+
+
All instances of JsonNull have the same hash code since they are indistinguishable +

+

+
Overrides:
hashCode in class Object
+
+
+
+
+
+
+ +

+equals

+
+public boolean equals(Object other)
+
+
All instances of JsonNull are the same +

+

+
Overrides:
equals in class Object
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/JsonObject.html b/gson/docs/javadocs/com/google/gson/JsonObject.html new file mode 100644 index 00000000..7b2f62de --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/JsonObject.html @@ -0,0 +1,534 @@ + + + + + + + +JsonObject (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson +
+Class JsonObject

+
+java.lang.Object
+  extended by com.google.gson.JsonElement
+      extended by com.google.gson.JsonObject
+
+
+
+
public final class JsonObject
extends JsonElement
+ + +

+A class representing an object type in Json. An object consists of name-value pairs where names + are strings, and values are any other type of JsonElement. This allows for a creating a + tree of JsonElements. The member elements of this object are maintained in order they were added. +

+ +

+

+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
JsonObject() + +
+          Creates an empty JsonObject.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidadd(String property, + JsonElement value) + +
+          Adds a member, which is a name-value pair, to self.
+ voidaddProperty(String property, + Boolean value) + +
+          Convenience method to add a boolean member.
+ voidaddProperty(String property, + Character value) + +
+          Convenience method to add a char member.
+ voidaddProperty(String property, + Number value) + +
+          Convenience method to add a primitive member.
+ voidaddProperty(String property, + String value) + +
+          Convenience method to add a primitive member.
+ Set<Map.Entry<String,JsonElement>>entrySet() + +
+          Returns a set of members of this object.
+ JsonElementget(String memberName) + +
+          Returns the member with the specified name.
+ JsonArraygetAsJsonArray(String memberName) + +
+          Convenience method to get the specified member as a JsonArray.
+ JsonObjectgetAsJsonObject(String memberName) + +
+          Convenience method to get the specified member as a JsonObject.
+ JsonPrimitivegetAsJsonPrimitive(String memberName) + +
+          Convenience method to get the specified member as a JsonPrimitive element.
+ booleanhas(String memberName) + +
+          Convenience method to check if a member with the specified name is present in this object.
+ JsonElementremove(String property) + +
+          Removes the property from this JsonObject.
+ + + + + + + +
Methods inherited from class com.google.gson.JsonElement
getAsBigDecimal, getAsBigInteger, getAsBoolean, getAsByte, getAsCharacter, getAsDouble, getAsFloat, getAsInt, getAsJsonArray, getAsJsonNull, getAsJsonObject, getAsJsonPrimitive, getAsLong, getAsNumber, getAsShort, getAsString, isJsonArray, isJsonNull, isJsonObject, isJsonPrimitive, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+JsonObject

+
+public JsonObject()
+
+
Creates an empty JsonObject. +

+

+ + + + + + + + +
+Method Detail
+ +

+add

+
+public void add(String property,
+                JsonElement value)
+
+
Adds a member, which is a name-value pair, to self. The name must be a String, but the value + can be an arbitrary JsonElement, thereby allowing you to build a full tree of JsonElements + rooted at this node. +

+

+
Parameters:
property - name of the member.
value - the member object.
+
+
+
+ +

+remove

+
+public JsonElement remove(String property)
+
+
Removes the property from this JsonObject. +

+

+
Parameters:
property - name of the member that should be removed. +
Returns:
the JsonElement object that is being removed.
Since:
+
1.3
+
+
+
+
+ +

+addProperty

+
+public void addProperty(String property,
+                        String value)
+
+
Convenience method to add a primitive member. The specified value is converted to a + JsonPrimitive of String. +

+

+
Parameters:
property - name of the member.
value - the string value associated with the member.
+
+
+
+ +

+addProperty

+
+public void addProperty(String property,
+                        Number value)
+
+
Convenience method to add a primitive member. The specified value is converted to a + JsonPrimitive of Number. +

+

+
Parameters:
property - name of the member.
value - the number value associated with the member.
+
+
+
+ +

+addProperty

+
+public void addProperty(String property,
+                        Boolean value)
+
+
Convenience method to add a boolean member. The specified value is converted to a + JsonPrimitive of Boolean. +

+

+
Parameters:
property - name of the member.
value - the number value associated with the member.
+
+
+
+ +

+addProperty

+
+public void addProperty(String property,
+                        Character value)
+
+
Convenience method to add a char member. The specified value is converted to a + JsonPrimitive of Character. +

+

+
Parameters:
property - name of the member.
value - the number value associated with the member.
+
+
+
+ +

+entrySet

+
+public Set<Map.Entry<String,JsonElement>> entrySet()
+
+
Returns a set of members of this object. The set is ordered, and the order is in which the + elements were added. +

+

+ +
Returns:
a set of members of this object.
+
+
+
+ +

+has

+
+public boolean has(String memberName)
+
+
Convenience method to check if a member with the specified name is present in this object. +

+

+
Parameters:
memberName - name of the member that is being checked for presence. +
Returns:
true if there is a member with the specified name, false otherwise.
+
+
+
+ +

+get

+
+public JsonElement get(String memberName)
+
+
Returns the member with the specified name. +

+

+
Parameters:
memberName - name of the member that is being requested. +
Returns:
the member matching the name. Null if no such member exists.
+
+
+
+ +

+getAsJsonPrimitive

+
+public JsonPrimitive getAsJsonPrimitive(String memberName)
+
+
Convenience method to get the specified member as a JsonPrimitive element. +

+

+
Parameters:
memberName - name of the member being requested. +
Returns:
the JsonPrimitive corresponding to the specified member.
+
+
+
+ +

+getAsJsonArray

+
+public JsonArray getAsJsonArray(String memberName)
+
+
Convenience method to get the specified member as a JsonArray. +

+

+
Parameters:
memberName - name of the member being requested. +
Returns:
the JsonArray corresponding to the specified member.
+
+
+
+ +

+getAsJsonObject

+
+public JsonObject getAsJsonObject(String memberName)
+
+
Convenience method to get the specified member as a JsonObject. +

+

+
Parameters:
memberName - name of the member being requested. +
Returns:
the JsonObject corresponding to the specified member.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/JsonParseException.html b/gson/docs/javadocs/com/google/gson/JsonParseException.html new file mode 100644 index 00000000..af437579 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/JsonParseException.html @@ -0,0 +1,302 @@ + + + + + + + +JsonParseException (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson +
+Class JsonParseException

+
+java.lang.Object
+  extended by java.lang.Throwable
+      extended by java.lang.Exception
+          extended by java.lang.RuntimeException
+              extended by com.google.gson.JsonParseException
+
+
+
All Implemented Interfaces:
Serializable
+
+
+
Direct Known Subclasses:
JsonIOException, JsonSyntaxException
+
+
+
+
public class JsonParseException
extends RuntimeException
+ + +

+This exception is raised if there is a serious issue that occurs during parsing of a Json + string. One of the main usages for this class is for the Gson infrastructure. If the incoming + Json is bad/malicious, an instance of this exception is raised. + +

This exception is a RuntimeException because it is exposed to the client. Using a + RuntimeException avoids bad coding practices on the client side where they catch the + exception and do nothing. It is often the case that you want to blow up if there is a parsing + error (i.e. often clients do not know how to recover from a JsonParseException.

+

+ +

+

+
Author:
+
Inderjeet Singh, Joel Leitch
+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + + + + + + + +
+Constructor Summary
JsonParseException(String msg) + +
+          Creates exception with the specified message.
JsonParseException(String msg, + Throwable cause) + +
+          Creates exception with the specified message and cause.
JsonParseException(Throwable cause) + +
+          Creates exception with the specified cause.
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+JsonParseException

+
+public JsonParseException(String msg)
+
+
Creates exception with the specified message. If you are wrapping another exception, consider + using JsonParseException(String, Throwable) instead. +

+

+
Parameters:
msg - error message describing a possible cause of this exception.
+
+
+ +

+JsonParseException

+
+public JsonParseException(String msg,
+                          Throwable cause)
+
+
Creates exception with the specified message and cause. +

+

+
Parameters:
msg - error message describing what happened.
cause - root exception that caused this exception to be thrown.
+
+
+ +

+JsonParseException

+
+public JsonParseException(Throwable cause)
+
+
Creates exception with the specified cause. Consider using + JsonParseException(String, Throwable) instead if you can describe what happened. +

+

+
Parameters:
cause - root exception that caused this exception to be thrown.
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/JsonParser.html b/gson/docs/javadocs/com/google/gson/JsonParser.html new file mode 100644 index 00000000..71672fb5 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/JsonParser.html @@ -0,0 +1,332 @@ + + + + + + + +JsonParser (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson +
+Class JsonParser

+
+java.lang.Object
+  extended by com.google.gson.JsonParser
+
+
+
+
public final class JsonParser
extends Object
+ + +

+A parser to parse Json into a parse tree of JsonElements +

+ +

+

+
Since:
+
1.3
+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
JsonParser() + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ JsonElementparse(JsonReader json) + +
+          Returns the next value from the JSON stream as a parse tree.
+ JsonElementparse(Reader json) + +
+          Parses the specified JSON string into a parse tree
+ JsonElementparse(String json) + +
+          Parses the specified JSON string into a parse tree
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+JsonParser

+
+public JsonParser()
+
+
+ + + + + + + + +
+Method Detail
+ +

+parse

+
+public JsonElement parse(String json)
+                  throws JsonSyntaxException
+
+
Parses the specified JSON string into a parse tree +

+

+
Parameters:
json - JSON text +
Returns:
a parse tree of JsonElements corresponding to the specified JSON +
Throws: +
JsonParseException - if the specified text is not valid JSON +
JsonSyntaxException
Since:
+
1.3
+
+
+
+
+ +

+parse

+
+public JsonElement parse(Reader json)
+                  throws JsonIOException,
+                         JsonSyntaxException
+
+
Parses the specified JSON string into a parse tree +

+

+
Parameters:
json - JSON text +
Returns:
a parse tree of JsonElements corresponding to the specified JSON +
Throws: +
JsonParseException - if the specified text is not valid JSON +
JsonIOException +
JsonSyntaxException
Since:
+
1.3
+
+
+
+
+ +

+parse

+
+public JsonElement parse(JsonReader json)
+                  throws JsonIOException,
+                         JsonSyntaxException
+
+
Returns the next value from the JSON stream as a parse tree. +

+

+ +
Throws: +
JsonParseException - if there is an IOException or if the specified + text is not valid JSON +
JsonIOException +
JsonSyntaxException
Since:
+
1.6
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/JsonPrimitive.html b/gson/docs/javadocs/com/google/gson/JsonPrimitive.html new file mode 100644 index 00000000..9e9e8c4f --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/JsonPrimitive.html @@ -0,0 +1,745 @@ + + + + + + + +JsonPrimitive (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson +
+Class JsonPrimitive

+
+java.lang.Object
+  extended by com.google.gson.JsonElement
+      extended by com.google.gson.JsonPrimitive
+
+
+
+
public final class JsonPrimitive
extends JsonElement
+ + +

+A class representing a Json primitive value. A primitive value + is either a String, a Java primitive, or a Java primitive + wrapper type. +

+ +

+

+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ +

+ + + + + + + + + + + + + + + + + + + + +
+Constructor Summary
JsonPrimitive(Boolean bool) + +
+          Create a primitive containing a boolean value.
JsonPrimitive(Character c) + +
+          Create a primitive containing a character.
JsonPrimitive(Number number) + +
+          Create a primitive containing a Number.
JsonPrimitive(String string) + +
+          Create a primitive containing a String value.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ booleanequals(Object obj) + +
+           
+ BigDecimalgetAsBigDecimal() + +
+          convenience method to get this element as a BigDecimal.
+ BigIntegergetAsBigInteger() + +
+          convenience method to get this element as a BigInteger.
+ booleangetAsBoolean() + +
+          convenience method to get this element as a boolean value.
+ bytegetAsByte() + +
+          convenience method to get this element as a primitive byte value.
+ chargetAsCharacter() + +
+          convenience method to get this element as a primitive character value.
+ doublegetAsDouble() + +
+          convenience method to get this element as a primitive double.
+ floatgetAsFloat() + +
+          convenience method to get this element as a float.
+ intgetAsInt() + +
+          convenience method to get this element as a primitive integer.
+ longgetAsLong() + +
+          convenience method to get this element as a primitive long.
+ NumbergetAsNumber() + +
+          convenience method to get this element as a Number.
+ shortgetAsShort() + +
+          convenience method to get this element as a primitive short.
+ StringgetAsString() + +
+          convenience method to get this element as a String.
+ inthashCode() + +
+           
+ booleanisBoolean() + +
+          Check whether this primitive contains a boolean value.
+ booleanisNumber() + +
+          Check whether this primitive contains a Number.
+ booleanisString() + +
+          Check whether this primitive contains a String value.
+ + + + + + + +
Methods inherited from class com.google.gson.JsonElement
getAsJsonArray, getAsJsonNull, getAsJsonObject, getAsJsonPrimitive, isJsonArray, isJsonNull, isJsonObject, isJsonPrimitive, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+JsonPrimitive

+
+public JsonPrimitive(Boolean bool)
+
+
Create a primitive containing a boolean value. +

+

+
Parameters:
bool - the value to create the primitive with.
+
+
+ +

+JsonPrimitive

+
+public JsonPrimitive(Number number)
+
+
Create a primitive containing a Number. +

+

+
Parameters:
number - the value to create the primitive with.
+
+
+ +

+JsonPrimitive

+
+public JsonPrimitive(String string)
+
+
Create a primitive containing a String value. +

+

+
Parameters:
string - the value to create the primitive with.
+
+
+ +

+JsonPrimitive

+
+public JsonPrimitive(Character c)
+
+
Create a primitive containing a character. The character is turned into a one character String + since Json only supports String. +

+

+
Parameters:
c - the value to create the primitive with.
+
+ + + + + + + + +
+Method Detail
+ +

+isBoolean

+
+public boolean isBoolean()
+
+
Check whether this primitive contains a boolean value. +

+

+ +
Returns:
true if this primitive contains a boolean value, false otherwise.
+
+
+
+ +

+getAsBoolean

+
+public boolean getAsBoolean()
+
+
convenience method to get this element as a boolean value. +

+

+
Overrides:
getAsBoolean in class JsonElement
+
+
+ +
Returns:
get this element as a primitive boolean value. +
Throws: +
ClassCastException - if the value contained is not a valid boolean value.
+
+
+
+ +

+isNumber

+
+public boolean isNumber()
+
+
Check whether this primitive contains a Number. +

+

+ +
Returns:
true if this primitive contains a Number, false otherwise.
+
+
+
+ +

+getAsNumber

+
+public Number getAsNumber()
+
+
convenience method to get this element as a Number. +

+

+
Overrides:
getAsNumber in class JsonElement
+
+
+ +
Returns:
get this element as a Number. +
Throws: +
ClassCastException - if the value contained is not a valid Number.
+
+
+
+ +

+isString

+
+public boolean isString()
+
+
Check whether this primitive contains a String value. +

+

+ +
Returns:
true if this primitive contains a String value, false otherwise.
+
+
+
+ +

+getAsString

+
+public String getAsString()
+
+
convenience method to get this element as a String. +

+

+
Overrides:
getAsString in class JsonElement
+
+
+ +
Returns:
get this element as a String. +
Throws: +
ClassCastException - if the value contained is not a valid String.
+
+
+
+ +

+getAsDouble

+
+public double getAsDouble()
+
+
convenience method to get this element as a primitive double. +

+

+
Overrides:
getAsDouble in class JsonElement
+
+
+ +
Returns:
get this element as a primitive double. +
Throws: +
ClassCastException - if the value contained is not a valid double.
+
+
+
+ +

+getAsBigDecimal

+
+public BigDecimal getAsBigDecimal()
+
+
convenience method to get this element as a BigDecimal. +

+

+
Overrides:
getAsBigDecimal in class JsonElement
+
+
+ +
Returns:
get this element as a BigDecimal. +
Throws: +
NumberFormatException - if the value contained is not a valid BigDecimal.
+
+
+
+ +

+getAsBigInteger

+
+public BigInteger getAsBigInteger()
+
+
convenience method to get this element as a BigInteger. +

+

+
Overrides:
getAsBigInteger in class JsonElement
+
+
+ +
Returns:
get this element as a BigInteger. +
Throws: +
NumberFormatException - if the value contained is not a valid BigInteger.
+
+
+
+ +

+getAsFloat

+
+public float getAsFloat()
+
+
convenience method to get this element as a float. +

+

+
Overrides:
getAsFloat in class JsonElement
+
+
+ +
Returns:
get this element as a float. +
Throws: +
ClassCastException - if the value contained is not a valid float.
+
+
+
+ +

+getAsLong

+
+public long getAsLong()
+
+
convenience method to get this element as a primitive long. +

+

+
Overrides:
getAsLong in class JsonElement
+
+
+ +
Returns:
get this element as a primitive long. +
Throws: +
ClassCastException - if the value contained is not a valid long.
+
+
+
+ +

+getAsShort

+
+public short getAsShort()
+
+
convenience method to get this element as a primitive short. +

+

+
Overrides:
getAsShort in class JsonElement
+
+
+ +
Returns:
get this element as a primitive short. +
Throws: +
ClassCastException - if the value contained is not a valid short value.
+
+
+
+ +

+getAsInt

+
+public int getAsInt()
+
+
convenience method to get this element as a primitive integer. +

+

+
Overrides:
getAsInt in class JsonElement
+
+
+ +
Returns:
get this element as a primitive integer. +
Throws: +
ClassCastException - if the value contained is not a valid integer.
+
+
+
+ +

+getAsByte

+
+public byte getAsByte()
+
+
Description copied from class: JsonElement
+
convenience method to get this element as a primitive byte value. +

+

+
Overrides:
getAsByte in class JsonElement
+
+
+ +
Returns:
get this element as a primitive byte value.
+
+
+
+ +

+getAsCharacter

+
+public char getAsCharacter()
+
+
Description copied from class: JsonElement
+
convenience method to get this element as a primitive character value. +

+

+
Overrides:
getAsCharacter in class JsonElement
+
+
+ +
Returns:
get this element as a primitive char value.
+
+
+
+ +

+hashCode

+
+public int hashCode()
+
+
+
Overrides:
hashCode in class Object
+
+
+
+
+
+
+ +

+equals

+
+public boolean equals(Object obj)
+
+
+
Overrides:
equals in class Object
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/JsonSerializationContext.html b/gson/docs/javadocs/com/google/gson/JsonSerializationContext.html new file mode 100644 index 00000000..4eb2e3d0 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/JsonSerializationContext.html @@ -0,0 +1,246 @@ + + + + + + + +JsonSerializationContext (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson +
+Interface JsonSerializationContext

+
+
+
public interface JsonSerializationContext
+ + +

+Context for serialization that is passed to a custom serializer during invocation of its + JsonSerializer.serialize(Object, Type, JsonSerializationContext) method. +

+ +

+

+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ +

+ + + + + + + + + + + + + + + + +
+Method Summary
+ JsonElementserialize(Object src) + +
+          Invokes default serialization on the specified object.
+ JsonElementserialize(Object src, + Type typeOfSrc) + +
+          Invokes default serialization on the specified object passing the specific type information.
+  +

+ + + + + + + + +
+Method Detail
+ +

+serialize

+
+JsonElement serialize(Object src)
+
+
Invokes default serialization on the specified object. +

+

+
Parameters:
src - the object that needs to be serialized. +
Returns:
a tree of JsonElements corresponding to the serialized form of src.
+
+
+
+ +

+serialize

+
+JsonElement serialize(Object src,
+                      Type typeOfSrc)
+
+
Invokes default serialization on the specified object passing the specific type information. + It should never be invoked on the element received as a parameter of the + JsonSerializer.serialize(Object, Type, JsonSerializationContext) method. Doing + so will result in an infinite loop since Gson will in-turn call the custom serializer again. +

+

+
Parameters:
src - the object that needs to be serialized.
typeOfSrc - the actual genericized type of src object. +
Returns:
a tree of JsonElements corresponding to the serialized form of src.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/JsonSerializer.html b/gson/docs/javadocs/com/google/gson/JsonSerializer.html new file mode 100644 index 00000000..ddeb386b --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/JsonSerializer.html @@ -0,0 +1,272 @@ + + + + + + + +JsonSerializer (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson +
+Interface JsonSerializer<T>

+
+
Type Parameters:
T - type for which the serializer is being registered. It is possible that a serializer + may be asked to serialize a specific generic type of the T.
+
+
+
public interface JsonSerializer<T>
+ + +

+Interface representing a custom serializer for Json. You should write a custom serializer, if + you are not happy with the default serialization done by Gson. You will also need to register + this serializer through GsonBuilder.registerTypeAdapter(Type, Object). + +

Let us look at example where defining a serializer will be useful. The Id class + defined below has two fields: clazz and value.

+ +

+ public class Id<T> {
+   private final Class<T> clazz;
+   private final long value;
+
+   public Id(Class<T> clazz, long value) {
+     this.clazz = clazz;
+     this.value = value;
+   }
+
+   public long getValue() {
+     return value;
+   }
+ }
+ 

+ +

The default serialization of Id(com.foo.MyObject.class, 20L) will be + {"clazz":com.foo.MyObject,"value":20}. Suppose, you just want the output to be + the value instead, which is 20 in this case. You can achieve that by writing a custom + serializer:

+ +

+ class IdSerializer implements JsonSerializer<Id>() {
+   public JsonElement toJson(Id id, Type typeOfId, JsonSerializationContext context) {
+     return new JsonPrimitive(id.getValue());
+   }
+ }
+ 

+ +

You will also need to register IdSerializer with Gson as follows:

+
+ Gson gson = new GsonBuilder().registerTypeAdapter(Id.class, new IdSerializer()).create();
+ 
+

+ +

+

+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ +

+ + + + + + + + + + + + +
+Method Summary
+ JsonElementserialize(T src, + Type typeOfSrc, + JsonSerializationContext context) + +
+          Gson invokes this call-back method during serialization when it encounters a field of the + specified type.
+  +

+ + + + + + + + +
+Method Detail
+ +

+serialize

+
+JsonElement serialize(T src,
+                      Type typeOfSrc,
+                      JsonSerializationContext context)
+
+
Gson invokes this call-back method during serialization when it encounters a field of the + specified type. + +

In the implementation of this call-back method, you should consider invoking + JsonSerializationContext.serialize(Object, Type) method to create JsonElements for any + non-trivial field of the src object. However, you should never invoke it on the + src object itself since that will cause an infinite loop (Gson will call your + call-back method again).

+

+

+
Parameters:
src - the object that needs to be converted to Json.
typeOfSrc - the actual type (fully genericized version) of the source object. +
Returns:
a JsonElement corresponding to the specified object.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/JsonStreamParser.html b/gson/docs/javadocs/com/google/gson/JsonStreamParser.html new file mode 100644 index 00000000..2ad2e04e --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/JsonStreamParser.html @@ -0,0 +1,369 @@ + + + + + + + +JsonStreamParser (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson +
+Class JsonStreamParser

+
+java.lang.Object
+  extended by com.google.gson.JsonStreamParser
+
+
+
All Implemented Interfaces:
Iterator<JsonElement>
+
+
+
+
public final class JsonStreamParser
extends Object
implements Iterator<JsonElement>
+ + +

+A streaming parser that allows reading of multiple JsonElements from the specified reader + asynchronously. + +

This class is conditionally thread-safe (see Item 70, Effective Java second edition). To + properly use this class across multiple threads, you will need to add some external + synchronization. For example: + +

+ JsonStreamParser parser = new JsonStreamParser("['first'] {'second':10} 'third'");
+ JsonElement element;
+ synchronized (parser) {  // synchronize on an object shared by threads
+   if (parser.hasNext()) {
+     element = parser.next();
+   }
+ }
+ 
+

+ +

+

+
Since:
+
1.4
+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ +

+ + + + + + + + + + + + + + +
+Constructor Summary
JsonStreamParser(Reader reader) + +
+           
JsonStreamParser(String json) + +
+           
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ booleanhasNext() + +
+          Returns true if a JsonElement is available on the input for consumption
+ JsonElementnext() + +
+          Returns the next available JsonElement on the reader.
+ voidremove() + +
+          This optional Iterator method is not relevant for stream parsing and hence is not + implemented.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+JsonStreamParser

+
+public JsonStreamParser(String json)
+
+
+
Parameters:
json - The string containing JSON elements concatenated to each other.
Since:
+
1.4
+
+
+
+ +

+JsonStreamParser

+
+public JsonStreamParser(Reader reader)
+
+
+
Parameters:
reader - The data stream containing JSON elements concatenated to each other.
Since:
+
1.4
+
+
+ + + + + + + + +
+Method Detail
+ +

+next

+
+public JsonElement next()
+                 throws JsonParseException
+
+
Returns the next available JsonElement on the reader. Null if none available. +

+

+
Specified by:
next in interface Iterator<JsonElement>
+
+
+ +
Returns:
the next available JsonElement on the reader. Null if none available. +
Throws: +
JsonParseException - if the incoming stream is malformed JSON.
Since:
+
1.4
+
+
+
+
+ +

+hasNext

+
+public boolean hasNext()
+
+
Returns true if a JsonElement is available on the input for consumption +

+

+
Specified by:
hasNext in interface Iterator<JsonElement>
+
+
+ +
Returns:
true if a JsonElement is available on the input, false otherwise
Since:
+
1.4
+
+
+
+
+ +

+remove

+
+public void remove()
+
+
This optional Iterator method is not relevant for stream parsing and hence is not + implemented. +

+

+
Specified by:
remove in interface Iterator<JsonElement>
+
+
+
Since:
+
1.4
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/JsonSyntaxException.html b/gson/docs/javadocs/com/google/gson/JsonSyntaxException.html new file mode 100644 index 00000000..a68e795e --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/JsonSyntaxException.html @@ -0,0 +1,286 @@ + + + + + + + +JsonSyntaxException (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson +
+Class JsonSyntaxException

+
+java.lang.Object
+  extended by java.lang.Throwable
+      extended by java.lang.Exception
+          extended by java.lang.RuntimeException
+              extended by com.google.gson.JsonParseException
+                  extended by com.google.gson.JsonSyntaxException
+
+
+
All Implemented Interfaces:
Serializable
+
+
+
+
public final class JsonSyntaxException
extends JsonParseException
+ + +

+This exception is raised when Gson attempts to read (or write) a malformed + JSON element. +

+ +

+

+
Author:
+
Inderjeet Singh, Joel Leitch
+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + + + + + + + +
+Constructor Summary
JsonSyntaxException(String msg) + +
+           
JsonSyntaxException(String msg, + Throwable cause) + +
+           
JsonSyntaxException(Throwable cause) + +
+          Creates exception with the specified cause.
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+JsonSyntaxException

+
+public JsonSyntaxException(String msg)
+
+
+
+ +

+JsonSyntaxException

+
+public JsonSyntaxException(String msg,
+                           Throwable cause)
+
+
+
+ +

+JsonSyntaxException

+
+public JsonSyntaxException(Throwable cause)
+
+
Creates exception with the specified cause. Consider using + JsonSyntaxException(String, Throwable) instead if you can + describe what actually happened. +

+

+
Parameters:
cause - root exception that caused this exception to be thrown.
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/LongSerializationPolicy.html b/gson/docs/javadocs/com/google/gson/LongSerializationPolicy.html new file mode 100644 index 00000000..781da3ca --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/LongSerializationPolicy.html @@ -0,0 +1,365 @@ + + + + + + + +LongSerializationPolicy (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson +
+Enum LongSerializationPolicy

+
+java.lang.Object
+  extended by java.lang.Enum<LongSerializationPolicy>
+      extended by com.google.gson.LongSerializationPolicy
+
+
+
All Implemented Interfaces:
Serializable, Comparable<LongSerializationPolicy>
+
+
+
+
public enum LongSerializationPolicy
extends Enum<LongSerializationPolicy>
+ + +

+Defines the expected format for a long or Long type when its serialized. +

+ +

+

+
Since:
+
1.3
+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ +

+ + + + + + + + + + + + + +
+Enum Constant Summary
DEFAULT + +
+          This is the "default" serialization policy that will output a long object as a JSON + number.
STRING + +
+          Serializes a long value as a quoted string.
+  + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ JsonElementserialize(Long value) + +
+          Serialize this value using this serialization policy.
+static LongSerializationPolicyvalueOf(String name) + +
+          Returns the enum constant of this type with the specified name.
+static LongSerializationPolicy[]values() + +
+          Returns an array containing the constants of this enum type, in +the order they are declared.
+ + + + + + + +
Methods inherited from class java.lang.Enum
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
+ + + + + + + +
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Enum Constant Detail
+ +

+DEFAULT

+
+public static final LongSerializationPolicy DEFAULT
+
+
This is the "default" serialization policy that will output a long object as a JSON + number. For example, assume an object has a long field named "f" then the serialized output + would be: + {"f":123}. +

+

+
+
+
+ +

+STRING

+
+public static final LongSerializationPolicy STRING
+
+
Serializes a long value as a quoted string. For example, assume an object has a long field + named "f" then the serialized output would be: + {"f":"123"}. +

+

+
+
+ + + + + + + + +
+Method Detail
+ +

+values

+
+public static LongSerializationPolicy[] values()
+
+
Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
+for (LongSerializationPolicy c : LongSerializationPolicy.values())
+    System.out.println(c);
+
+

+

+ +
Returns:
an array containing the constants of this enum type, in +the order they are declared
+
+
+
+ +

+valueOf

+
+public static LongSerializationPolicy valueOf(String name)
+
+
Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.) +

+

+
Parameters:
name - the name of the enum constant to be returned. +
Returns:
the enum constant with the specified name +
Throws: +
IllegalArgumentException - if this enum type has no constant +with the specified name +
NullPointerException - if the argument is null
+
+
+
+ +

+serialize

+
+public JsonElement serialize(Long value)
+
+
Serialize this value using this serialization policy. +

+

+
Parameters:
value - the long value to be serialized into a JsonElement +
Returns:
the serialized version of value
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/annotations/Expose.html b/gson/docs/javadocs/com/google/gson/annotations/Expose.html new file mode 100644 index 00000000..5d91bfb7 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/annotations/Expose.html @@ -0,0 +1,277 @@ + + + + + + + +Expose (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson.annotations +
+Annotation Type Expose

+
+
+
@Retention(value=RUNTIME)
+@Target(value=FIELD)
+public @interface Expose
+ + +

+An annotation that indicates this member should be exposed for JSON + serialization or deserialization. + +

This annotation has no effect unless you build Gson + with a GsonBuilder and invoke + GsonBuilder.excludeFieldsWithoutExposeAnnotation() + method.

+ +

Here is an example of how this annotation is meant to be used: +

+ public class User {
+   @Expose private String firstName;
+   @Expose(serialize = false) private String lastName;
+   @Expose (serialize = false, deserialize = false) private String emailAddress;
+   private String password;
+ }
+ 

+ If you created Gson with new Gson(), the toJson() and fromJson() + methods will use the password field along-with firstName, lastName, + and emailAddress for serialization and deserialization. However, if you created Gson + with Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create() + then the toJson() and fromJson() methods of Gson will exclude the + password field. This is because the password field is not marked with the + @Expose annotation. Gson will also exclude lastName and emailAddress + from serialization since serialize is set to false. Similarly, Gson will + exclude emailAddress from deserialization since deserialize is set to false. + +

Note that another way to achieve the same effect would have been to just mark the + password field as transient, and Gson would have excluded it even with default + settings. The @Expose annotation is useful in a style of programming where you want to + explicitly specify all fields that should get considered for serialization or deserialization. +

+ +

+

+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ +

+ + + + + + + + + + + + + + + +
+Optional Element Summary
+ booleandeserialize + +
+          If true, the field marked with this annotation is deserialized from the JSON.
+ booleanserialize + +
+          If true, the field marked with this annotation is written out in the JSON while + serializing.
+  +

+

+serialize

+
+public abstract boolean serialize
+
+
If true, the field marked with this annotation is written out in the JSON while + serializing. If false, the field marked with this annotation is skipped from the + serialized output. Defaults to true. +

+

+
+
+
+
Since:
+
1.4
+
+
+
Default:
true
+
+
+
+ +

+deserialize

+
+public abstract boolean deserialize
+
+
If true, the field marked with this annotation is deserialized from the JSON. + If false, the field marked with this annotation is skipped during deserialization. + Defaults to true. +

+

+
+
+
+
Since:
+
1.4
+
+
+
Default:
true
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/annotations/SerializedName.html b/gson/docs/javadocs/com/google/gson/annotations/SerializedName.html new file mode 100644 index 00000000..3788df6e --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/annotations/SerializedName.html @@ -0,0 +1,253 @@ + + + + + + + +SerializedName (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson.annotations +
+Annotation Type SerializedName

+
+
+
@Retention(value=RUNTIME)
+@Target(value=FIELD)
+public @interface SerializedName
+ + +

+An annotation that indicates this member should be serialized to JSON with + the provided name value as its field name. + +

This annotation will override any FieldNamingPolicy, including + the default field naming policy, that may have been set on the Gson + instance. A different naming policy can set using the GsonBuilder class. See + GsonBuilder.setFieldNamingPolicy(com.google.gson.FieldNamingPolicy) + for more information.

+ +

Here is an example of how this annotation is meant to be used:

+
+ public class SomeClassWithFields {
+   @SerializedName("name") private final String someField;
+   private final String someOtherField;
+
+   public SomeClassWithFields(String a, String b) {
+     this.someField = a;
+     this.someOtherField = b;
+   }
+ }
+ 
+ +

The following shows the output that is generated when serializing an instance of the + above example class:

+
+ SomeClassWithFields objectToSerialize = new SomeClassWithFields("a", "b");
+ Gson gson = new Gson();
+ String jsonRepresentation = gson.toJson(objectToSerialize);
+ System.out.println(jsonRepresentation);
+
+ ===== OUTPUT =====
+ {"name":"a","someOtherField":"b"}
+ 
+ +

NOTE: The value you specify in this annotation must be a valid JSON field name.

+

+ +

+

+
Author:
+
Inderjeet Singh, Joel Leitch
+
See Also:
FieldNamingPolicy
+
+ +

+ + + + + + + + + + + +
+Required Element Summary
+ Stringvalue + +
+           
+  +

+ + + + + + + + +
+Element Detail
+ +

+value

+
+public abstract String value
+
+
+
+
+
+ +
Returns:
the desired name of the field when it is serialized
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/annotations/Since.html b/gson/docs/javadocs/com/google/gson/annotations/Since.html new file mode 100644 index 00000000..672730a0 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/annotations/Since.html @@ -0,0 +1,245 @@ + + + + + + + +Since (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson.annotations +
+Annotation Type Since

+
+
+
@Retention(value=RUNTIME)
+@Target(value={FIELD,TYPE})
+public @interface Since
+ + +

+An annotation that indicates the version number since a member or a type has been present. + This annotation is useful to manage versioning of your Json classes for a web-service. + +

+ This annotation has no effect unless you build Gson with a + GsonBuilder and invoke + GsonBuilder.setVersion(double) method. + +

Here is an example of how this annotation is meant to be used:

+
+ public class User {
+   private String firstName;
+   private String lastName;
+   @Since(1.0) private String emailAddress;
+   @Since(1.0) private String password;
+   @Since(1.1) private Address address;
+ }
+ 
+ +

If you created Gson with new Gson(), the toJson() and fromJson() + methods will use all the fields for serialization and deserialization. However, if you created + Gson with Gson gson = new GsonBuilder().setVersion(1.0).create() then the + toJson() and fromJson() methods of Gson will exclude the address field + since it's version number is set to 1.1.

+

+ +

+

+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ +

+ + + + + + + + + + + +
+Required Element Summary
+ doublevalue + +
+          the value indicating a version number since this member + or type has been present.
+  +

+ + + + + + + + +
+Element Detail
+ +

+value

+
+public abstract double value
+
+
the value indicating a version number since this member + or type has been present. +

+

+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/annotations/Until.html b/gson/docs/javadocs/com/google/gson/annotations/Until.html new file mode 100644 index 00000000..54bcc3c5 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/annotations/Until.html @@ -0,0 +1,250 @@ + + + + + + + +Until (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson.annotations +
+Annotation Type Until

+
+
+
@Retention(value=RUNTIME)
+@Target(value={FIELD,TYPE})
+public @interface Until
+ + +

+An annotation that indicates the version number until a member or a type should be present. + Basically, if Gson is created with a version number that exceeds the value stored in the + Until annotation then the field will be ignored from the JSON output. This annotation + is useful to manage versioning of your JSON classes for a web-service. + +

+ This annotation has no effect unless you build Gson with a + GsonBuilder and invoke + GsonBuilder.setVersion(double) method. + +

Here is an example of how this annotation is meant to be used:

+
+ public class User {
+   private String firstName;
+   private String lastName;
+   @Until(1.1) private String emailAddress;
+   @Until(1.1) private String password;
+ }
+ 
+ +

If you created Gson with new Gson(), the toJson() and fromJson() + methods will use all the fields for serialization and deserialization. However, if you created + Gson with Gson gson = new GsonBuilder().setVersion(1.2).create() then the + toJson() and fromJson() methods of Gson will exclude the emailAddress + and password fields from the example above, because the version number passed to the + GsonBuilder, 1.2, exceeds the version number set on the Until annotation, + 1.1, for those fields. +

+ +

+

+
Since:
+
1.3
+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ +

+ + + + + + + + + + + +
+Required Element Summary
+ doublevalue + +
+          the value indicating a version number until this member + or type should be ignored.
+  +

+ + + + + + + + +
+Element Detail
+ +

+value

+
+public abstract double value
+
+
the value indicating a version number until this member + or type should be ignored. +

+

+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/annotations/class-use/Expose.html b/gson/docs/javadocs/com/google/gson/annotations/class-use/Expose.html new file mode 100644 index 00000000..ad817ae2 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/annotations/class-use/Expose.html @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class com.google.gson.annotations.Expose (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.annotations.Expose

+
+No usage of com.google.gson.annotations.Expose +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/annotations/class-use/SerializedName.html b/gson/docs/javadocs/com/google/gson/annotations/class-use/SerializedName.html new file mode 100644 index 00000000..cc3f30fd --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/annotations/class-use/SerializedName.html @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class com.google.gson.annotations.SerializedName (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.annotations.SerializedName

+
+No usage of com.google.gson.annotations.SerializedName +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/annotations/class-use/Since.html b/gson/docs/javadocs/com/google/gson/annotations/class-use/Since.html new file mode 100644 index 00000000..245b2761 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/annotations/class-use/Since.html @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class com.google.gson.annotations.Since (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.annotations.Since

+
+No usage of com.google.gson.annotations.Since +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/annotations/class-use/Until.html b/gson/docs/javadocs/com/google/gson/annotations/class-use/Until.html new file mode 100644 index 00000000..dad20b5c --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/annotations/class-use/Until.html @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class com.google.gson.annotations.Until (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.annotations.Until

+
+No usage of com.google.gson.annotations.Until +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/annotations/package-frame.html b/gson/docs/javadocs/com/google/gson/annotations/package-frame.html new file mode 100644 index 00000000..f511e598 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/annotations/package-frame.html @@ -0,0 +1,39 @@ + + + + + + + +com.google.gson.annotations (Gson 1.6 API) + + + + + + + + + + + +com.google.gson.annotations + + + + +
+Annotation Types  + +
+Expose +
+SerializedName +
+Since +
+Until
+ + + + diff --git a/gson/docs/javadocs/com/google/gson/annotations/package-summary.html b/gson/docs/javadocs/com/google/gson/annotations/package-summary.html new file mode 100644 index 00000000..242ad5c4 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/annotations/package-summary.html @@ -0,0 +1,189 @@ + + + + + + + +com.google.gson.annotations (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package com.google.gson.annotations +

+This package provides annotations that can be used with Gson. +

+See: +
+          Description +

+ + + + + + + + + + + + + + + + + + + + + +
+Annotation Types Summary
ExposeAn annotation that indicates this member should be exposed for JSON + serialization or deserialization.
SerializedNameAn annotation that indicates this member should be serialized to JSON with + the provided name value as its field name.
SinceAn annotation that indicates the version number since a member or a type has been present.
UntilAn annotation that indicates the version number until a member or a type should be present.
+  + +

+

+Package com.google.gson.annotations Description +

+ +

+This package provides annotations that can be used with Gson. +

+ +

+

+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/annotations/package-tree.html b/gson/docs/javadocs/com/google/gson/annotations/package-tree.html new file mode 100644 index 00000000..41af98e8 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/annotations/package-tree.html @@ -0,0 +1,156 @@ + + + + + + + +com.google.gson.annotations Class Hierarchy (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package com.google.gson.annotations +

+
+
+
Package Hierarchies:
All Packages
+
+

+Annotation Type Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/annotations/package-use.html b/gson/docs/javadocs/com/google/gson/annotations/package-use.html new file mode 100644 index 00000000..974d81e2 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/annotations/package-use.html @@ -0,0 +1,145 @@ + + + + + + + +Uses of Package com.google.gson.annotations (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Package
com.google.gson.annotations

+
+No usage of com.google.gson.annotations +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/class-use/ExclusionStrategy.html b/gson/docs/javadocs/com/google/gson/class-use/ExclusionStrategy.html new file mode 100644 index 00000000..94f2534f --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/class-use/ExclusionStrategy.html @@ -0,0 +1,183 @@ + + + + + + + +Uses of Interface com.google.gson.ExclusionStrategy (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Interface
com.google.gson.ExclusionStrategy

+
+ + + + + + + + + +
+Packages that use ExclusionStrategy
com.google.gsonThis package provides the Gson class to convert Json to Java and + vice-versa. 
+  +

+ + + + + +
+Uses of ExclusionStrategy in com.google.gson
+  +

+ + + + + + + + + +
Methods in com.google.gson with parameters of type ExclusionStrategy
+ GsonBuilderGsonBuilder.setExclusionStrategies(ExclusionStrategy... strategies) + +
+          Configures Gson to apply a set of exclusion strategies during both serialization and + deserialization.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/class-use/FieldAttributes.html b/gson/docs/javadocs/com/google/gson/class-use/FieldAttributes.html new file mode 100644 index 00000000..0fbcd978 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/class-use/FieldAttributes.html @@ -0,0 +1,182 @@ + + + + + + + +Uses of Class com.google.gson.FieldAttributes (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.FieldAttributes

+
+ + + + + + + + + +
+Packages that use FieldAttributes
com.google.gsonThis package provides the Gson class to convert Json to Java and + vice-versa. 
+  +

+ + + + + +
+Uses of FieldAttributes in com.google.gson
+  +

+ + + + + + + + + +
Methods in com.google.gson with parameters of type FieldAttributes
+ booleanExclusionStrategy.shouldSkipField(FieldAttributes f) + +
+           
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/class-use/FieldNamingPolicy.html b/gson/docs/javadocs/com/google/gson/class-use/FieldNamingPolicy.html new file mode 100644 index 00000000..ff94c622 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/class-use/FieldNamingPolicy.html @@ -0,0 +1,208 @@ + + + + + + + +Uses of Class com.google.gson.FieldNamingPolicy (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.FieldNamingPolicy

+
+ + + + + + + + + +
+Packages that use FieldNamingPolicy
com.google.gsonThis package provides the Gson class to convert Json to Java and + vice-versa. 
+  +

+ + + + + +
+Uses of FieldNamingPolicy in com.google.gson
+  +

+ + + + + + + + + + + + + +
Methods in com.google.gson that return FieldNamingPolicy
+static FieldNamingPolicyFieldNamingPolicy.valueOf(String name) + +
+          Returns the enum constant of this type with the specified name.
+static FieldNamingPolicy[]FieldNamingPolicy.values() + +
+          Returns an array containing the constants of this enum type, in +the order they are declared.
+  +

+ + + + + + + + + +
Methods in com.google.gson with parameters of type FieldNamingPolicy
+ GsonBuilderGsonBuilder.setFieldNamingPolicy(FieldNamingPolicy namingConvention) + +
+          Configures Gson to apply a specific naming policy to an object's field during serialization + and deserialization.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/class-use/FieldNamingStrategy.html b/gson/docs/javadocs/com/google/gson/class-use/FieldNamingStrategy.html new file mode 100644 index 00000000..87564931 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/class-use/FieldNamingStrategy.html @@ -0,0 +1,183 @@ + + + + + + + +Uses of Interface com.google.gson.FieldNamingStrategy (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Interface
com.google.gson.FieldNamingStrategy

+
+ + + + + + + + + +
+Packages that use FieldNamingStrategy
com.google.gsonThis package provides the Gson class to convert Json to Java and + vice-versa. 
+  +

+ + + + + +
+Uses of FieldNamingStrategy in com.google.gson
+  +

+ + + + + + + + + +
Methods in com.google.gson with parameters of type FieldNamingStrategy
+ GsonBuilderGsonBuilder.setFieldNamingStrategy(FieldNamingStrategy fieldNamingStrategy) + +
+          Configures Gson to apply a specific naming policy strategy to an object's field during + serialization and deserialization.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/class-use/Gson.html b/gson/docs/javadocs/com/google/gson/class-use/Gson.html new file mode 100644 index 00000000..bdbae1de --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/class-use/Gson.html @@ -0,0 +1,182 @@ + + + + + + + +Uses of Class com.google.gson.Gson (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.Gson

+
+ + + + + + + + + +
+Packages that use Gson
com.google.gsonThis package provides the Gson class to convert Json to Java and + vice-versa. 
+  +

+ + + + + +
+Uses of Gson in com.google.gson
+  +

+ + + + + + + + + +
Methods in com.google.gson that return Gson
+ GsonGsonBuilder.create() + +
+          Creates a Gson instance based on the current configuration.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/class-use/GsonBuilder.html b/gson/docs/javadocs/com/google/gson/class-use/GsonBuilder.html new file mode 100644 index 00000000..23d82504 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/class-use/GsonBuilder.html @@ -0,0 +1,319 @@ + + + + + + + +Uses of Class com.google.gson.GsonBuilder (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.GsonBuilder

+
+ + + + + + + + + +
+Packages that use GsonBuilder
com.google.gsonThis package provides the Gson class to convert Json to Java and + vice-versa. 
+  +

+ + + + + +
+Uses of GsonBuilder in com.google.gson
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in com.google.gson that return GsonBuilder
+ GsonBuilderGsonBuilder.disableHtmlEscaping() + +
+          By default, Gson escapes HTML characters such as < > etc.
+ GsonBuilderGsonBuilder.disableInnerClassSerialization() + +
+          Configures Gson to exclude inner classes during serialization.
+ GsonBuilderGsonBuilder.excludeFieldsWithModifiers(int... modifiers) + +
+          Configures Gson to excludes all class fields that have the specified modifiers.
+ GsonBuilderGsonBuilder.excludeFieldsWithoutExposeAnnotation() + +
+          Configures Gson to exclude all fields from consideration for serialization or deserialization + that do not have the Expose annotation.
+ GsonBuilderGsonBuilder.generateNonExecutableJson() + +
+          Makes the output JSON non-executable in Javascript by prefixing the generated JSON with some + special text.
+ GsonBuilderGsonBuilder.registerTypeAdapter(Type type, + Object typeAdapter) + +
+          Configures Gson for custom serialization or deserialization.
+ GsonBuilderGsonBuilder.serializeNulls() + +
+          Configure Gson to serialize null fields.
+ GsonBuilderGsonBuilder.serializeSpecialFloatingPointValues() + +
+          Section 2.4 of JSON specification disallows + special double values (NaN, Infinity, -Infinity).
+ GsonBuilderGsonBuilder.setDateFormat(int style) + +
+          Configures Gson to to serialize Date objects according to the style value provided.
+ GsonBuilderGsonBuilder.setDateFormat(int dateStyle, + int timeStyle) + +
+          Configures Gson to to serialize Date objects according to the style value provided.
+ GsonBuilderGsonBuilder.setDateFormat(String pattern) + +
+          Configures Gson to serialize Date objects according to the pattern provided.
+ GsonBuilderGsonBuilder.setExclusionStrategies(ExclusionStrategy... strategies) + +
+          Configures Gson to apply a set of exclusion strategies during both serialization and + deserialization.
+ GsonBuilderGsonBuilder.setFieldNamingPolicy(FieldNamingPolicy namingConvention) + +
+          Configures Gson to apply a specific naming policy to an object's field during serialization + and deserialization.
+ GsonBuilderGsonBuilder.setFieldNamingStrategy(FieldNamingStrategy fieldNamingStrategy) + +
+          Configures Gson to apply a specific naming policy strategy to an object's field during + serialization and deserialization.
+ GsonBuilderGsonBuilder.setLongSerializationPolicy(LongSerializationPolicy serializationPolicy) + +
+          Configures Gson to apply a specific serialization policy for Long and long + objects.
+ GsonBuilderGsonBuilder.setPrettyPrinting() + +
+          Configures Gson to output Json that fits in a page for pretty printing.
+ GsonBuilderGsonBuilder.setVersion(double ignoreVersionsAfter) + +
+          Configures Gson to enable versioning support.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/class-use/InstanceCreator.html b/gson/docs/javadocs/com/google/gson/class-use/InstanceCreator.html new file mode 100644 index 00000000..9190d10b --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/class-use/InstanceCreator.html @@ -0,0 +1,145 @@ + + + + + + + +Uses of Interface com.google.gson.InstanceCreator (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Interface
com.google.gson.InstanceCreator

+
+No usage of com.google.gson.InstanceCreator +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/class-use/JsonArray.html b/gson/docs/javadocs/com/google/gson/class-use/JsonArray.html new file mode 100644 index 00000000..1af4c490 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/class-use/JsonArray.html @@ -0,0 +1,206 @@ + + + + + + + +Uses of Class com.google.gson.JsonArray (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.JsonArray

+
+ + + + + + + + + +
+Packages that use JsonArray
com.google.gsonThis package provides the Gson class to convert Json to Java and + vice-versa. 
+  +

+ + + + + +
+Uses of JsonArray in com.google.gson
+  +

+ + + + + + + + + + + + + +
Methods in com.google.gson that return JsonArray
+ JsonArrayJsonElement.getAsJsonArray() + +
+          convenience method to get this element as a JsonArray.
+ JsonArrayJsonObject.getAsJsonArray(String memberName) + +
+          Convenience method to get the specified member as a JsonArray.
+  +

+ + + + + + + + + +
Methods in com.google.gson with parameters of type JsonArray
+ voidJsonArray.addAll(JsonArray array) + +
+          Adds all the elements of the specified array to self.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/class-use/JsonDeserializationContext.html b/gson/docs/javadocs/com/google/gson/class-use/JsonDeserializationContext.html new file mode 100644 index 00000000..624ea517 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/class-use/JsonDeserializationContext.html @@ -0,0 +1,185 @@ + + + + + + + +Uses of Interface com.google.gson.JsonDeserializationContext (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Interface
com.google.gson.JsonDeserializationContext

+
+ + + + + + + + + +
+Packages that use JsonDeserializationContext
com.google.gsonThis package provides the Gson class to convert Json to Java and + vice-versa. 
+  +

+ + + + + +
+Uses of JsonDeserializationContext in com.google.gson
+  +

+ + + + + + + + + +
Methods in com.google.gson with parameters of type JsonDeserializationContext
+ TJsonDeserializer.deserialize(JsonElement json, + Type typeOfT, + JsonDeserializationContext context) + +
+          Gson invokes this call-back method during deserialization when it encounters a field of the + specified type.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/class-use/JsonDeserializer.html b/gson/docs/javadocs/com/google/gson/class-use/JsonDeserializer.html new file mode 100644 index 00000000..5be73e43 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/class-use/JsonDeserializer.html @@ -0,0 +1,145 @@ + + + + + + + +Uses of Interface com.google.gson.JsonDeserializer (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Interface
com.google.gson.JsonDeserializer

+
+No usage of com.google.gson.JsonDeserializer +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/class-use/JsonElement.html b/gson/docs/javadocs/com/google/gson/class-use/JsonElement.html new file mode 100644 index 00000000..039c26f9 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/class-use/JsonElement.html @@ -0,0 +1,461 @@ + + + + + + + +Uses of Class com.google.gson.JsonElement (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.JsonElement

+
+ + + + + + + + + +
+Packages that use JsonElement
com.google.gsonThis package provides the Gson class to convert Json to Java and + vice-versa. 
+  +

+ + + + + +
+Uses of JsonElement in com.google.gson
+  +

+ + + + + + + + + + + + + + + + + + + + + +
Subclasses of JsonElement in com.google.gson
+ classJsonArray + +
+          A class representing an array type in Json.
+ classJsonNull + +
+          A class representing a Json null value.
+ classJsonObject + +
+          A class representing an object type in Json.
+ classJsonPrimitive + +
+          A class representing a Json primitive value.
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in com.google.gson that return JsonElement
+ JsonElementJsonArray.get(int i) + +
+          Returns the ith element of the array.
+ JsonElementJsonObject.get(String memberName) + +
+          Returns the member with the specified name.
+ JsonElementJsonStreamParser.next() + +
+          Returns the next available JsonElement on the reader.
+ JsonElementJsonParser.parse(JsonReader json) + +
+          Returns the next value from the JSON stream as a parse tree.
+ JsonElementJsonParser.parse(Reader json) + +
+          Parses the specified JSON string into a parse tree
+ JsonElementJsonParser.parse(String json) + +
+          Parses the specified JSON string into a parse tree
+ JsonElementJsonObject.remove(String property) + +
+          Removes the property from this JsonObject.
+ JsonElementLongSerializationPolicy.serialize(Long value) + +
+          Serialize this value using this serialization policy.
+ JsonElementJsonSerializationContext.serialize(Object src) + +
+          Invokes default serialization on the specified object.
+ JsonElementJsonSerializationContext.serialize(Object src, + Type typeOfSrc) + +
+          Invokes default serialization on the specified object passing the specific type information.
+ JsonElementJsonSerializer.serialize(T src, + Type typeOfSrc, + JsonSerializationContext context) + +
+          Gson invokes this call-back method during serialization when it encounters a field of the + specified type.
+ JsonElementGson.toJsonTree(Object src) + +
+          This method serializes the specified object into its equivalent representation as a tree of + JsonElements.
+ JsonElementGson.toJsonTree(Object src, + Type typeOfSrc) + +
+          This method serializes the specified object, including those of generic types, into its + equivalent representation as a tree of JsonElements.
+  +

+ + + + + + + + + + + + + +
Methods in com.google.gson that return types with arguments of type JsonElement
+ Set<Map.Entry<String,JsonElement>>JsonObject.entrySet() + +
+          Returns a set of members of this object.
+ Iterator<JsonElement>JsonArray.iterator() + +
+          Returns an iterator to navigate the elemetns of the array.
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in com.google.gson with parameters of type JsonElement
+ voidJsonArray.add(JsonElement element) + +
+          Adds the specified element to self.
+ voidJsonObject.add(String property, + JsonElement value) + +
+          Adds a member, which is a name-value pair, to self.
+ + + + + +
+<T> T
+
JsonDeserializationContext.deserialize(JsonElement json, + Type typeOfT) + +
+          Invokes default deserialization on the specified object.
+ TJsonDeserializer.deserialize(JsonElement json, + Type typeOfT, + JsonDeserializationContext context) + +
+          Gson invokes this call-back method during deserialization when it encounters a field of the + specified type.
+ + + + + +
+<T> T
+
Gson.fromJson(JsonElement json, + Class<T> classOfT) + +
+          This method deserializes the Json read from the specified parse tree into an object of the + specified type.
+ + + + + +
+<T> T
+
Gson.fromJson(JsonElement json, + Type typeOfT) + +
+          This method deserializes the Json read from the specified parse tree into an object of the + specified type.
+ StringGson.toJson(JsonElement jsonElement) + +
+          Converts a tree of JsonElements into its equivalent JSON representation.
+ voidGson.toJson(JsonElement jsonElement, + Appendable writer) + +
+          Writes out the equivalent JSON for a tree of JsonElements.
+ voidGson.toJson(JsonElement jsonElement, + JsonWriter writer) + +
+          Writes the JSON for jsonElement to writer.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/class-use/JsonIOException.html b/gson/docs/javadocs/com/google/gson/class-use/JsonIOException.html new file mode 100644 index 00000000..bf893fea --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/class-use/JsonIOException.html @@ -0,0 +1,290 @@ + + + + + + + +Uses of Class com.google.gson.JsonIOException (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.JsonIOException

+
+ + + + + + + + + +
+Packages that use JsonIOException
com.google.gsonThis package provides the Gson class to convert Json to Java and + vice-versa. 
+  +

+ + + + + +
+Uses of JsonIOException in com.google.gson
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in com.google.gson that throw JsonIOException
+ + + + + +
+<T> T
+
Gson.fromJson(JsonReader reader, + Type typeOfT) + +
+          Reads the next JSON value from reader and convert it to an object + of type typeOfT.
+ + + + + +
+<T> T
+
Gson.fromJson(Reader json, + Class<T> classOfT) + +
+          This method deserializes the Json read from the specified reader into an object of the + specified class.
+ + + + + +
+<T> T
+
Gson.fromJson(Reader json, + Type typeOfT) + +
+          This method deserializes the Json read from the specified reader into an object of the + specified type.
+ JsonElementJsonParser.parse(JsonReader json) + +
+          Returns the next value from the JSON stream as a parse tree.
+ JsonElementJsonParser.parse(Reader json) + +
+          Parses the specified JSON string into a parse tree
+ voidGson.toJson(JsonElement jsonElement, + Appendable writer) + +
+          Writes out the equivalent JSON for a tree of JsonElements.
+ voidGson.toJson(JsonElement jsonElement, + JsonWriter writer) + +
+          Writes the JSON for jsonElement to writer.
+ voidGson.toJson(Object src, + Appendable writer) + +
+          This method serializes the specified object into its equivalent Json representation.
+ voidGson.toJson(Object src, + Type typeOfSrc, + Appendable writer) + +
+          This method serializes the specified object, including those of generic types, into its + equivalent Json representation.
+ voidGson.toJson(Object src, + Type typeOfSrc, + JsonWriter writer) + +
+          Writes the JSON representation of src of type typeOfSrc to + writer.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/class-use/JsonNull.html b/gson/docs/javadocs/com/google/gson/class-use/JsonNull.html new file mode 100644 index 00000000..6692a0f8 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/class-use/JsonNull.html @@ -0,0 +1,182 @@ + + + + + + + +Uses of Class com.google.gson.JsonNull (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.JsonNull

+
+ + + + + + + + + +
+Packages that use JsonNull
com.google.gsonThis package provides the Gson class to convert Json to Java and + vice-versa. 
+  +

+ + + + + +
+Uses of JsonNull in com.google.gson
+  +

+ + + + + + + + + +
Methods in com.google.gson that return JsonNull
+ JsonNullJsonElement.getAsJsonNull() + +
+          convenience method to get this element as a JsonNull.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/class-use/JsonObject.html b/gson/docs/javadocs/com/google/gson/class-use/JsonObject.html new file mode 100644 index 00000000..26b5a00e --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/class-use/JsonObject.html @@ -0,0 +1,190 @@ + + + + + + + +Uses of Class com.google.gson.JsonObject (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.JsonObject

+
+ + + + + + + + + +
+Packages that use JsonObject
com.google.gsonThis package provides the Gson class to convert Json to Java and + vice-versa. 
+  +

+ + + + + +
+Uses of JsonObject in com.google.gson
+  +

+ + + + + + + + + + + + + +
Methods in com.google.gson that return JsonObject
+ JsonObjectJsonElement.getAsJsonObject() + +
+          convenience method to get this element as a JsonObject.
+ JsonObjectJsonObject.getAsJsonObject(String memberName) + +
+          Convenience method to get the specified member as a JsonObject.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/class-use/JsonParseException.html b/gson/docs/javadocs/com/google/gson/class-use/JsonParseException.html new file mode 100644 index 00000000..8193f035 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/class-use/JsonParseException.html @@ -0,0 +1,235 @@ + + + + + + + +Uses of Class com.google.gson.JsonParseException (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.JsonParseException

+
+ + + + + + + + + +
+Packages that use JsonParseException
com.google.gsonThis package provides the Gson class to convert Json to Java and + vice-versa. 
+  +

+ + + + + +
+Uses of JsonParseException in com.google.gson
+  +

+ + + + + + + + + + + + + +
Subclasses of JsonParseException in com.google.gson
+ classJsonIOException + +
+          This exception is raised when Gson was unable to read an input stream + or write to one.
+ classJsonSyntaxException + +
+          This exception is raised when Gson attempts to read (or write) a malformed + JSON element.
+  +

+ + + + + + + + + + + + + + + + + +
Methods in com.google.gson that throw JsonParseException
+ + + + + +
+<T> T
+
JsonDeserializationContext.deserialize(JsonElement json, + Type typeOfT) + +
+          Invokes default deserialization on the specified object.
+ TJsonDeserializer.deserialize(JsonElement json, + Type typeOfT, + JsonDeserializationContext context) + +
+          Gson invokes this call-back method during deserialization when it encounters a field of the + specified type.
+ JsonElementJsonStreamParser.next() + +
+          Returns the next available JsonElement on the reader.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/class-use/JsonParser.html b/gson/docs/javadocs/com/google/gson/class-use/JsonParser.html new file mode 100644 index 00000000..d7707293 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/class-use/JsonParser.html @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class com.google.gson.JsonParser (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.JsonParser

+
+No usage of com.google.gson.JsonParser +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/class-use/JsonPrimitive.html b/gson/docs/javadocs/com/google/gson/class-use/JsonPrimitive.html new file mode 100644 index 00000000..aa16b0e4 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/class-use/JsonPrimitive.html @@ -0,0 +1,190 @@ + + + + + + + +Uses of Class com.google.gson.JsonPrimitive (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.JsonPrimitive

+
+ + + + + + + + + +
+Packages that use JsonPrimitive
com.google.gsonThis package provides the Gson class to convert Json to Java and + vice-versa. 
+  +

+ + + + + +
+Uses of JsonPrimitive in com.google.gson
+  +

+ + + + + + + + + + + + + +
Methods in com.google.gson that return JsonPrimitive
+ JsonPrimitiveJsonElement.getAsJsonPrimitive() + +
+          convenience method to get this element as a JsonPrimitive.
+ JsonPrimitiveJsonObject.getAsJsonPrimitive(String memberName) + +
+          Convenience method to get the specified member as a JsonPrimitive element.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/class-use/JsonSerializationContext.html b/gson/docs/javadocs/com/google/gson/class-use/JsonSerializationContext.html new file mode 100644 index 00000000..4a765930 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/class-use/JsonSerializationContext.html @@ -0,0 +1,185 @@ + + + + + + + +Uses of Interface com.google.gson.JsonSerializationContext (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Interface
com.google.gson.JsonSerializationContext

+
+ + + + + + + + + +
+Packages that use JsonSerializationContext
com.google.gsonThis package provides the Gson class to convert Json to Java and + vice-versa. 
+  +

+ + + + + +
+Uses of JsonSerializationContext in com.google.gson
+  +

+ + + + + + + + + +
Methods in com.google.gson with parameters of type JsonSerializationContext
+ JsonElementJsonSerializer.serialize(T src, + Type typeOfSrc, + JsonSerializationContext context) + +
+          Gson invokes this call-back method during serialization when it encounters a field of the + specified type.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/class-use/JsonSerializer.html b/gson/docs/javadocs/com/google/gson/class-use/JsonSerializer.html new file mode 100644 index 00000000..2ce9161d --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/class-use/JsonSerializer.html @@ -0,0 +1,145 @@ + + + + + + + +Uses of Interface com.google.gson.JsonSerializer (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Interface
com.google.gson.JsonSerializer

+
+No usage of com.google.gson.JsonSerializer +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/class-use/JsonStreamParser.html b/gson/docs/javadocs/com/google/gson/class-use/JsonStreamParser.html new file mode 100644 index 00000000..75ea3886 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/class-use/JsonStreamParser.html @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class com.google.gson.JsonStreamParser (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.JsonStreamParser

+
+No usage of com.google.gson.JsonStreamParser +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/class-use/JsonSyntaxException.html b/gson/docs/javadocs/com/google/gson/class-use/JsonSyntaxException.html new file mode 100644 index 00000000..e4f5fcb1 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/class-use/JsonSyntaxException.html @@ -0,0 +1,315 @@ + + + + + + + +Uses of Class com.google.gson.JsonSyntaxException (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.JsonSyntaxException

+
+ + + + + + + + + +
+Packages that use JsonSyntaxException
com.google.gsonThis package provides the Gson class to convert Json to Java and + vice-versa. 
+  +

+ + + + + +
+Uses of JsonSyntaxException in com.google.gson
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in com.google.gson that throw JsonSyntaxException
+ + + + + +
+<T> T
+
Gson.fromJson(JsonElement json, + Class<T> classOfT) + +
+          This method deserializes the Json read from the specified parse tree into an object of the + specified type.
+ + + + + +
+<T> T
+
Gson.fromJson(JsonElement json, + Type typeOfT) + +
+          This method deserializes the Json read from the specified parse tree into an object of the + specified type.
+ + + + + +
+<T> T
+
Gson.fromJson(JsonReader reader, + Type typeOfT) + +
+          Reads the next JSON value from reader and convert it to an object + of type typeOfT.
+ + + + + +
+<T> T
+
Gson.fromJson(Reader json, + Class<T> classOfT) + +
+          This method deserializes the Json read from the specified reader into an object of the + specified class.
+ + + + + +
+<T> T
+
Gson.fromJson(Reader json, + Type typeOfT) + +
+          This method deserializes the Json read from the specified reader into an object of the + specified type.
+ + + + + +
+<T> T
+
Gson.fromJson(String json, + Class<T> classOfT) + +
+          This method deserializes the specified Json into an object of the specified class.
+ + + + + +
+<T> T
+
Gson.fromJson(String json, + Type typeOfT) + +
+          This method deserializes the specified Json into an object of the specified type.
+ JsonElementJsonParser.parse(JsonReader json) + +
+          Returns the next value from the JSON stream as a parse tree.
+ JsonElementJsonParser.parse(Reader json) + +
+          Parses the specified JSON string into a parse tree
+ JsonElementJsonParser.parse(String json) + +
+          Parses the specified JSON string into a parse tree
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/class-use/LongSerializationPolicy.html b/gson/docs/javadocs/com/google/gson/class-use/LongSerializationPolicy.html new file mode 100644 index 00000000..3092f90e --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/class-use/LongSerializationPolicy.html @@ -0,0 +1,208 @@ + + + + + + + +Uses of Class com.google.gson.LongSerializationPolicy (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.LongSerializationPolicy

+
+ + + + + + + + + +
+Packages that use LongSerializationPolicy
com.google.gsonThis package provides the Gson class to convert Json to Java and + vice-versa. 
+  +

+ + + + + +
+Uses of LongSerializationPolicy in com.google.gson
+  +

+ + + + + + + + + + + + + +
Methods in com.google.gson that return LongSerializationPolicy
+static LongSerializationPolicyLongSerializationPolicy.valueOf(String name) + +
+          Returns the enum constant of this type with the specified name.
+static LongSerializationPolicy[]LongSerializationPolicy.values() + +
+          Returns an array containing the constants of this enum type, in +the order they are declared.
+  +

+ + + + + + + + + +
Methods in com.google.gson with parameters of type LongSerializationPolicy
+ GsonBuilderGsonBuilder.setLongSerializationPolicy(LongSerializationPolicy serializationPolicy) + +
+          Configures Gson to apply a specific serialization policy for Long and long + objects.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/package-frame.html b/gson/docs/javadocs/com/google/gson/package-frame.html new file mode 100644 index 00000000..c950c8cd --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/package-frame.html @@ -0,0 +1,102 @@ + + + + + + + +com.google.gson (Gson 1.6 API) + + + + + + + + + + + +com.google.gson + + + + +
+Interfaces  + +
+ExclusionStrategy +
+FieldNamingStrategy +
+InstanceCreator +
+JsonDeserializationContext +
+JsonDeserializer +
+JsonSerializationContext +
+JsonSerializer
+ + + + + + +
+Classes  + +
+FieldAttributes +
+Gson +
+GsonBuilder +
+JsonArray +
+JsonElement +
+JsonNull +
+JsonObject +
+JsonParser +
+JsonPrimitive +
+JsonStreamParser
+ + + + + + +
+Enums  + +
+FieldNamingPolicy +
+LongSerializationPolicy
+ + + + + + +
+Exceptions  + +
+JsonIOException +
+JsonParseException +
+JsonSyntaxException
+ + + + diff --git a/gson/docs/javadocs/com/google/gson/package-summary.html b/gson/docs/javadocs/com/google/gson/package-summary.html new file mode 100644 index 00000000..2853d532 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/package-summary.html @@ -0,0 +1,305 @@ + + + + + + + +com.google.gson (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package com.google.gson +

+This package provides the Gson class to convert Json to Java and + vice-versa. +

+See: +
+          Description +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Interface Summary
ExclusionStrategyA strategy (or policy) definition that is used to decide whether or not a field or top-level + class should be serialized or deserialized as part of the JSON output/input.
FieldNamingStrategyA mechanism for providing custom field naming in Gson.
InstanceCreator<T>This interface is implemented to create instances of a class that does not define a no-args + constructor.
JsonDeserializationContextContext for deserialization that is passed to a custom deserializer during invocation of its + JsonDeserializer.deserialize(JsonElement, Type, JsonDeserializationContext) + method.
JsonDeserializer<T>Interface representing a custom deserializer for Json.
JsonSerializationContextContext for serialization that is passed to a custom serializer during invocation of its + JsonSerializer.serialize(Object, Type, JsonSerializationContext) method.
JsonSerializer<T>Interface representing a custom serializer for Json.
+  + +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Class Summary
FieldAttributesA data object that stores attributes of a field.
GsonThis is the main class for using Gson.
GsonBuilderUse this builder to construct a Gson instance when you need to set configuration + options other than the default.
JsonArrayA class representing an array type in Json.
JsonElementA class representing an element of Json.
JsonNullA class representing a Json null value.
JsonObjectA class representing an object type in Json.
JsonParserA parser to parse Json into a parse tree of JsonElements
JsonPrimitiveA class representing a Json primitive value.
JsonStreamParserA streaming parser that allows reading of multiple JsonElements from the specified reader + asynchronously.
+  + +

+ + + + + + + + + + + + + +
+Enum Summary
FieldNamingPolicyAn enumeration that defines a few standard naming conventions for JSON field names.
LongSerializationPolicyDefines the expected format for a long or Long type when its serialized.
+  + +

+ + + + + + + + + + + + + + + + + +
+Exception Summary
JsonIOExceptionThis exception is raised when Gson was unable to read an input stream + or write to one.
JsonParseExceptionThis exception is raised if there is a serious issue that occurs during parsing of a Json + string.
JsonSyntaxExceptionThis exception is raised when Gson attempts to read (or write) a malformed + JSON element.
+  + +

+

+Package com.google.gson Description +

+ +

+This package provides the Gson class to convert Json to Java and + vice-versa. + +

The primary class to use is Gson which can be constructed with + new Gson() (using default settings) or by using GsonBuilder + (to configure various options such as using versioning and so on).

+

+ +

+

+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/package-tree.html b/gson/docs/javadocs/com/google/gson/package-tree.html new file mode 100644 index 00000000..1a7158fb --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/package-tree.html @@ -0,0 +1,182 @@ + + + + + + + +com.google.gson Class Hierarchy (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package com.google.gson +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +

+Interface Hierarchy +

+ +

+Enum Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/package-use.html b/gson/docs/javadocs/com/google/gson/package-use.html new file mode 100644 index 00000000..7c373003 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/package-use.html @@ -0,0 +1,276 @@ + + + + + + + +Uses of Package com.google.gson (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Package
com.google.gson

+
+ + + + + + + + + +
+Packages that use com.google.gson
com.google.gsonThis package provides the Gson class to convert Json to Java and + vice-versa. 
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Classes in com.google.gson used by com.google.gson
ExclusionStrategy + +
+          A strategy (or policy) definition that is used to decide whether or not a field or top-level + class should be serialized or deserialized as part of the JSON output/input.
FieldAttributes + +
+          A data object that stores attributes of a field.
FieldNamingPolicy + +
+          An enumeration that defines a few standard naming conventions for JSON field names.
FieldNamingStrategy + +
+          A mechanism for providing custom field naming in Gson.
Gson + +
+          This is the main class for using Gson.
GsonBuilder + +
+          Use this builder to construct a Gson instance when you need to set configuration + options other than the default.
JsonArray + +
+          A class representing an array type in Json.
JsonDeserializationContext + +
+          Context for deserialization that is passed to a custom deserializer during invocation of its + JsonDeserializer.deserialize(JsonElement, Type, JsonDeserializationContext) + method.
JsonElement + +
+          A class representing an element of Json.
JsonIOException + +
+          This exception is raised when Gson was unable to read an input stream + or write to one.
JsonNull + +
+          A class representing a Json null value.
JsonObject + +
+          A class representing an object type in Json.
JsonParseException + +
+          This exception is raised if there is a serious issue that occurs during parsing of a Json + string.
JsonPrimitive + +
+          A class representing a Json primitive value.
JsonSerializationContext + +
+          Context for serialization that is passed to a custom serializer during invocation of its + JsonSerializer.serialize(Object, Type, JsonSerializationContext) method.
JsonSyntaxException + +
+          This exception is raised when Gson attempts to read (or write) a malformed + JSON element.
LongSerializationPolicy + +
+          Defines the expected format for a long or Long type when its serialized.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/reflect/TypeToken.html b/gson/docs/javadocs/com/google/gson/reflect/TypeToken.html new file mode 100644 index 00000000..abbef568 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/reflect/TypeToken.html @@ -0,0 +1,450 @@ + + + + + + + +TypeToken (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson.reflect +
+Class TypeToken<T>

+
+java.lang.Object
+  extended by com.google.gson.reflect.TypeToken<T>
+
+
+
+
public abstract class TypeToken<T>
extends Object
+ + +

+Represents a generic type T. + + You can use this class to get the generic type for a class. For example, + to get the generic type for Collection<Foo>, you can use: +

+ Type typeOfCollectionOfFoo = new TypeToken<Collection<Foo>>(){}.getType() + + +

Assumes Type implements equals() and hashCode() + as a value (as opposed to identity) comparison. + + Also implements isAssignableFrom(Type) to check type-safe + assignability. +

+ +

+

+
Author:
+
Bob Lee, Sven Mawson
+
+
+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ booleanequals(Object o) + +
+          Method to test equality.
+static + + + + +
+<T> TypeToken<T>
+
get(Class<T> type) + +
+          Gets type token for the given Class instance.
+static TypeToken<?>get(Type type) + +
+          Gets type token for the given Type instance.
+ Class<? super T>getRawType() + +
+          Gets the raw type.
+ TypegetType() + +
+          Gets underlying Type instance.
+ inthashCode() + +
+          Hashcode for this object.
+ booleanisAssignableFrom(Class<?> cls) + +
+          Check if this type is assignable from the given class object.
+ booleanisAssignableFrom(Type from) + +
+          Check if this type is assignable from the given Type.
+ booleanisAssignableFrom(TypeToken<?> token) + +
+          Check if this type is assignable from the given type token.
+ StringtoString() + +
+          Returns a string representation of this object.
+ + + + + + + +
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Method Detail
+ +

+getRawType

+
+public Class<? super T> getRawType()
+
+
Gets the raw type. +

+

+
+
+
+
+ +

+getType

+
+public Type getType()
+
+
Gets underlying Type instance. +

+

+
+
+
+
+ +

+isAssignableFrom

+
+public boolean isAssignableFrom(Class<?> cls)
+
+
Check if this type is assignable from the given class object. +

+

+
+
+
+
+ +

+isAssignableFrom

+
+public boolean isAssignableFrom(Type from)
+
+
Check if this type is assignable from the given Type. +

+

+
+
+
+
+ +

+isAssignableFrom

+
+public boolean isAssignableFrom(TypeToken<?> token)
+
+
Check if this type is assignable from the given type token. +

+

+
+
+
+
+ +

+hashCode

+
+public int hashCode()
+
+
Hashcode for this object. +

+

+
Overrides:
hashCode in class Object
+
+
+ +
Returns:
hashcode for this object.
+
+
+
+ +

+equals

+
+public boolean equals(Object o)
+
+
Method to test equality. +

+

+
Overrides:
equals in class Object
+
+
+ +
Returns:
true if this object is logically equal to the specified object, false otherwise.
+
+
+
+ +

+toString

+
+public String toString()
+
+
Returns a string representation of this object. +

+

+
Overrides:
toString in class Object
+
+
+ +
Returns:
a string representation of this object.
+
+
+
+ +

+get

+
+public static TypeToken<?> get(Type type)
+
+
Gets type token for the given Type instance. +

+

+
+
+
+
+ +

+get

+
+public static <T> TypeToken<T> get(Class<T> type)
+
+
Gets type token for the given Class instance. +

+

+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/reflect/class-use/TypeToken.html b/gson/docs/javadocs/com/google/gson/reflect/class-use/TypeToken.html new file mode 100644 index 00000000..5a281eb4 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/reflect/class-use/TypeToken.html @@ -0,0 +1,212 @@ + + + + + + + +Uses of Class com.google.gson.reflect.TypeToken (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.reflect.TypeToken

+
+ + + + + + + + + +
+Packages that use TypeToken
com.google.gson.reflectThis package provides utility classes for finding type information for generic types. 
+  +

+ + + + + +
+Uses of TypeToken in com.google.gson.reflect
+  +

+ + + + + + + + + + + + + +
Methods in com.google.gson.reflect that return TypeToken
+static + + + + +
+<T> TypeToken<T>
+
TypeToken.get(Class<T> type) + +
+          Gets type token for the given Class instance.
+static TypeToken<?>TypeToken.get(Type type) + +
+          Gets type token for the given Type instance.
+  +

+ + + + + + + + + +
Methods in com.google.gson.reflect with parameters of type TypeToken
+ booleanTypeToken.isAssignableFrom(TypeToken<?> token) + +
+          Check if this type is assignable from the given type token.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/reflect/package-frame.html b/gson/docs/javadocs/com/google/gson/reflect/package-frame.html new file mode 100644 index 00000000..c10d2f7e --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/reflect/package-frame.html @@ -0,0 +1,33 @@ + + + + + + + +com.google.gson.reflect (Gson 1.6 API) + + + + + + + + + + + +com.google.gson.reflect + + + + +
+Classes  + +
+TypeToken
+ + + + diff --git a/gson/docs/javadocs/com/google/gson/reflect/package-summary.html b/gson/docs/javadocs/com/google/gson/reflect/package-summary.html new file mode 100644 index 00000000..73978cbb --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/reflect/package-summary.html @@ -0,0 +1,175 @@ + + + + + + + +com.google.gson.reflect (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package com.google.gson.reflect +

+This package provides utility classes for finding type information for generic types. +

+See: +
+          Description +

+ + + + + + + + + +
+Class Summary
TypeToken<T>Represents a generic type T.
+  + +

+

+Package com.google.gson.reflect Description +

+ +

+This package provides utility classes for finding type information for generic types. +

+ +

+

+
Author:
+
Inderjeet Singh, Joel Leitch
+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/reflect/package-tree.html b/gson/docs/javadocs/com/google/gson/reflect/package-tree.html new file mode 100644 index 00000000..9a156ddf --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/reflect/package-tree.html @@ -0,0 +1,154 @@ + + + + + + + +com.google.gson.reflect Class Hierarchy (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package com.google.gson.reflect +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/reflect/package-use.html b/gson/docs/javadocs/com/google/gson/reflect/package-use.html new file mode 100644 index 00000000..31667c1a --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/reflect/package-use.html @@ -0,0 +1,171 @@ + + + + + + + +Uses of Package com.google.gson.reflect (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Package
com.google.gson.reflect

+
+ + + + + + + + + +
+Packages that use com.google.gson.reflect
com.google.gson.reflectThis package provides utility classes for finding type information for generic types. 
+  +

+ + + + + + + + +
+Classes in com.google.gson.reflect used by com.google.gson.reflect
TypeToken + +
+          Represents a generic type T.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/stream/JsonReader.html b/gson/docs/javadocs/com/google/gson/stream/JsonReader.html new file mode 100644 index 00000000..0df9c7e1 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/stream/JsonReader.html @@ -0,0 +1,940 @@ + + + + + + + +JsonReader (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson.stream +
+Class JsonReader

+
+java.lang.Object
+  extended by com.google.gson.stream.JsonReader
+
+
+
All Implemented Interfaces:
Closeable
+
+
+
+
public final class JsonReader
extends Object
implements Closeable
+ + +

+Reads a JSON (RFC 4627) + encoded value as a stream of tokens. This stream includes both literal + values (strings, numbers, booleans, and nulls) as well as the begin and + end delimiters of objects and arrays. The tokens are traversed in + depth-first order, the same order that they appear in the JSON document. + Within JSON objects, name/value pairs are represented by a single token. + +

Parsing JSON

+ To create a recursive descent parser your own JSON streams, first create an + entry point method that creates a JsonReader. + +

Next, create handler methods for each structure in your JSON text. You'll + need a method for each object type and for each array type. +

+

When a nested object or array is encountered, delegate to the + corresponding handler method. + +

When an unknown name is encountered, strict parsers should fail with an + exception. Lenient parsers should call skipValue() to recursively + skip the value's nested tokens, which may otherwise conflict. + +

If a value may be null, you should first check using peek(). + Null literals can be consumed using either nextNull() or skipValue(). + +

Example

+ Suppose we'd like to parse a stream of messages such as the following:
 [
+   {
+     "id": 912345678901,
+     "text": "How do I read a JSON stream in Java?",
+     "geo": null,
+     "user": {
+       "name": "json_newb",
+       "followers_count": 41
+      }
+   },
+   {
+     "id": 912345678902,
+     "text": "@json_newb just use JsonReader!",
+     "geo": [50.454722, -104.606667],
+     "user": {
+       "name": "jesse",
+       "followers_count": 2
+     }
+   }
+ ]
+ This code implements the parser for the above structure:
   public List<Message> readJsonStream(InputStream in) throws IOException {
+     JsonReader reader = new JsonReader(new InputStreamReader(in, "UTF-8"));
+     return readMessagesArray(reader);
+   }
+
+   public List<Message> readMessagesArray(JsonReader reader) throws IOException {
+     List<Message> messages = new ArrayList<Message>();
+
+     reader.beginArray();
+     while (reader.hasNext()) {
+       messages.add(readMessage(reader));
+     }
+     reader.endArray();
+     return messages;
+   }
+
+   public Message readMessage(JsonReader reader) throws IOException {
+     long id = -1;
+     String text = null;
+     User user = null;
+     List<Double> geo = null;
+
+     reader.beginObject();
+     while (reader.hasNext()) {
+       String name = reader.nextName();
+       if (name.equals("id")) {
+         id = reader.nextLong();
+       } else if (name.equals("text")) {
+         text = reader.nextString();
+       } else if (name.equals("geo") && reader.peek() != JsonToken.NULL) {
+         geo = readDoublesArray(reader);
+       } else if (name.equals("user")) {
+         user = readUser(reader);
+       } else {
+         reader.skipValue();
+       }
+     }
+     reader.endObject();
+     return new Message(id, text, user, geo);
+   }
+
+   public List<Double> readDoublesArray(JsonReader reader) throws IOException {
+     List<Double> doubles = new ArrayList<Double>();
+
+     reader.beginArray();
+     while (reader.hasNext()) {
+       doubles.add(reader.nextDouble());
+     }
+     reader.endArray();
+     return doubles;
+   }
+
+   public User readUser(JsonReader reader) throws IOException {
+     String username = null;
+     int followersCount = -1;
+
+     reader.beginObject();
+     while (reader.hasNext()) {
+       String name = reader.nextName();
+       if (name.equals("name")) {
+         username = reader.nextString();
+       } else if (name.equals("followers_count")) {
+         followersCount = reader.nextInt();
+       } else {
+         reader.skipValue();
+       }
+     }
+     reader.endObject();
+     return new User(username, followersCount);
+   }
+ +

Number Handling

+ This reader permits numeric values to be read as strings and string values to + be read as numbers. For example, both elements of the JSON array [1, "1"] may be read using either nextInt() or nextString(). + This behavior is intended to prevent lossy numeric conversions: double is + JavaScript's only numeric type and very large values like 9007199254740993 cannot be represented exactly on that platform. To minimize + precision loss, extremely large values should be written and read as strings + in JSON. + +

Non-Execute Prefix

+ Web servers that serve private data using JSON may be vulnerable to
Cross-site + request forgery attacks. In such an attack, a malicious site gains access + to a private JSON file by executing it with an HTML <script> tag. + +

Prefixing JSON files with ")]}'\n" makes them non-executable + by <script> tags, disarming the attack. Since the prefix is malformed + JSON, strict parsing fails when it is encountered. This class permits the + non-execute prefix when lenient parsing is + enabled. + +

Each JsonReader may be used to read a single JSON stream. Instances + of this class are not thread safe. +

+ +

+

+
Since:
+
1.6
+
Author:
+
Jesse Wilson
+
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
JsonReader(Reader in) + +
+          Creates a new instance that reads a JSON-encoded stream from in.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ voidbeginArray() + +
+          Consumes the next token from the JSON stream and asserts that it is the + beginning of a new array.
+ voidbeginObject() + +
+          Consumes the next token from the JSON stream and asserts that it is the + beginning of a new object.
+ voidclose() + +
+          Closes this JSON reader and the underlying Reader.
+ voidendArray() + +
+          Consumes the next token from the JSON stream and asserts that it is the + end of the current array.
+ voidendObject() + +
+          Consumes the next token from the JSON stream and asserts that it is the + end of the current array.
+ booleanhasNext() + +
+          Returns true if the current array or object has another element.
+ booleanisLenient() + +
+          Returns true if this parser is liberal in what it accepts.
+ booleannextBoolean() + +
+          Returns the boolean value of the next token, + consuming it.
+ doublenextDouble() + +
+          Returns the double value of the next token, + consuming it.
+ intnextInt() + +
+          Returns the int value of the next token, + consuming it.
+ longnextLong() + +
+          Returns the long value of the next token, + consuming it.
+ StringnextName() + +
+          Returns the next token, a property name, and + consumes it.
+ voidnextNull() + +
+          Consumes the next token from the JSON stream and asserts that it is a + literal null.
+ StringnextString() + +
+          Returns the string value of the next token, + consuming it.
+ JsonTokenpeek() + +
+          Returns the type of the next token without consuming it.
+ voidsetLenient(boolean lenient) + +
+          Configure this parser to be be liberal in what it accepts.
+ voidskipValue() + +
+          Skips the next value recursively.
+ StringtoString() + +
+           
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+JsonReader

+
+public JsonReader(Reader in)
+
+
Creates a new instance that reads a JSON-encoded stream from in. +

+

+ + + + + + + + +
+Method Detail
+ +

+setLenient

+
+public void setLenient(boolean lenient)
+
+
Configure this parser to be be liberal in what it accepts. By default, + this parser is strict and only accepts JSON as specified by RFC 4627. Setting the + parser to lenient causes it to ignore the following syntax errors: + + +

+

+
+
+
+
+
+
+
+ +

+isLenient

+
+public boolean isLenient()
+
+
Returns true if this parser is liberal in what it accepts. +

+

+
+
+
+
+
+
+
+ +

+beginArray

+
+public void beginArray()
+                throws IOException
+
+
Consumes the next token from the JSON stream and asserts that it is the + beginning of a new array. +

+

+
+
+
+ +
Throws: +
IOException
+
+
+
+ +

+endArray

+
+public void endArray()
+              throws IOException
+
+
Consumes the next token from the JSON stream and asserts that it is the + end of the current array. +

+

+
+
+
+ +
Throws: +
IOException
+
+
+
+ +

+beginObject

+
+public void beginObject()
+                 throws IOException
+
+
Consumes the next token from the JSON stream and asserts that it is the + beginning of a new object. +

+

+
+
+
+ +
Throws: +
IOException
+
+
+
+ +

+endObject

+
+public void endObject()
+               throws IOException
+
+
Consumes the next token from the JSON stream and asserts that it is the + end of the current array. +

+

+
+
+
+ +
Throws: +
IOException
+
+
+
+ +

+hasNext

+
+public boolean hasNext()
+                throws IOException
+
+
Returns true if the current array or object has another element. +

+

+
+
+
+ +
Throws: +
IOException
+
+
+
+ +

+peek

+
+public JsonToken peek()
+               throws IOException
+
+
Returns the type of the next token without consuming it. +

+

+
+
+
+ +
Throws: +
IOException
+
+
+
+ +

+nextName

+
+public String nextName()
+                throws IOException
+
+
Returns the next token, a property name, and + consumes it. +

+

+
+
+
+ +
Throws: +
IOException - if the next token in the stream is not a property + name.
+
+
+
+ +

+nextString

+
+public String nextString()
+                  throws IOException
+
+
Returns the string value of the next token, + consuming it. If the next token is a number, this method will return its + string form. +

+

+
+
+
+ +
Throws: +
IllegalStateException - if the next token is not a string or if + this reader is closed. +
IOException
+
+
+
+ +

+nextBoolean

+
+public boolean nextBoolean()
+                    throws IOException
+
+
Returns the boolean value of the next token, + consuming it. +

+

+
+
+
+ +
Throws: +
IllegalStateException - if the next token is not a boolean or if + this reader is closed. +
IOException
+
+
+
+ +

+nextNull

+
+public void nextNull()
+              throws IOException
+
+
Consumes the next token from the JSON stream and asserts that it is a + literal null. +

+

+
+
+
+ +
Throws: +
IllegalStateException - if the next token is not null or if this + reader is closed. +
IOException
+
+
+
+ +

+nextDouble

+
+public double nextDouble()
+                  throws IOException
+
+
Returns the double value of the next token, + consuming it. If the next token is a string, this method will attempt to + parse it as a double. +

+

+
+
+
+ +
Throws: +
IllegalStateException - if the next token is not a literal value. +
NumberFormatException - if the next literal value cannot be parsed + as a double, or is non-finite. +
IOException
+
+
+
+ +

+nextLong

+
+public long nextLong()
+              throws IOException
+
+
Returns the long value of the next token, + consuming it. If the next token is a string, this method will attempt to + parse it as a long. If the next token's numeric value cannot be exactly + represented by a Java long, this method throws. +

+

+
+
+
+ +
Throws: +
IllegalStateException - if the next token is not a literal value. +
NumberFormatException - if the next literal value cannot be parsed + as a number, or exactly represented as a long. +
IOException
+
+
+
+ +

+nextInt

+
+public int nextInt()
+            throws IOException
+
+
Returns the int value of the next token, + consuming it. If the next token is a string, this method will attempt to + parse it as an int. If the next token's numeric value cannot be exactly + represented by a Java int, this method throws. +

+

+
+
+
+ +
Throws: +
IllegalStateException - if the next token is not a literal value. +
NumberFormatException - if the next literal value cannot be parsed + as a number, or exactly represented as an int. +
IOException
+
+
+
+ +

+close

+
+public void close()
+           throws IOException
+
+
Closes this JSON reader and the underlying Reader. +

+

+
Specified by:
close in interface Closeable
+
+
+ +
Throws: +
IOException
+
+
+
+ +

+skipValue

+
+public void skipValue()
+               throws IOException
+
+
Skips the next value recursively. If it is an object or array, all nested + elements are skipped. This method is intended for use when the JSON token + stream contains unrecognized or unhandled values. +

+

+
+
+
+ +
Throws: +
IOException
+
+
+
+ +

+toString

+
+public String toString()
+
+
+
Overrides:
toString in class Object
+
+
+
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/stream/JsonToken.html b/gson/docs/javadocs/com/google/gson/stream/JsonToken.html new file mode 100644 index 00000000..9b3bbd47 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/stream/JsonToken.html @@ -0,0 +1,487 @@ + + + + + + + +JsonToken (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson.stream +
+Enum JsonToken

+
+java.lang.Object
+  extended by java.lang.Enum<JsonToken>
+      extended by com.google.gson.stream.JsonToken
+
+
+
All Implemented Interfaces:
Serializable, Comparable<JsonToken>
+
+
+
+
public enum JsonToken
extends Enum<JsonToken>
+ + +

+A structure, name or value type in a JSON-encoded string. +

+ +

+

+
Since:
+
1.6
+
Author:
+
Jesse Wilson
+
+
+ +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Enum Constant Summary
BEGIN_ARRAY + +
+          The opening of a JSON array.
BEGIN_OBJECT + +
+          The opening of a JSON object.
BOOLEAN + +
+          A JSON true or false.
END_ARRAY + +
+          The closing of a JSON array.
END_DOCUMENT + +
+          The end of the JSON stream.
END_OBJECT + +
+          The closing of a JSON object.
NAME + +
+          A JSON property name.
NULL + +
+          A JSON null.
NUMBER + +
+          A JSON number represented in this API by a Java double, long, or int.
STRING + +
+          A JSON string.
+  + + + + + + + + + + + + + + + +
+Method Summary
+static JsonTokenvalueOf(String name) + +
+          Returns the enum constant of this type with the specified name.
+static JsonToken[]values() + +
+          Returns an array containing the constants of this enum type, in +the order they are declared.
+ + + + + + + +
Methods inherited from class java.lang.Enum
compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
+ + + + + + + +
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Enum Constant Detail
+ +

+BEGIN_ARRAY

+
+public static final JsonToken BEGIN_ARRAY
+
+
The opening of a JSON array. Written using JsonWriter.beginObject() + and read using JsonReader.beginObject(). +

+

+
+
+
+ +

+END_ARRAY

+
+public static final JsonToken END_ARRAY
+
+
The closing of a JSON array. Written using JsonWriter.endArray() + and read using JsonReader.endArray(). +

+

+
+
+
+ +

+BEGIN_OBJECT

+
+public static final JsonToken BEGIN_OBJECT
+
+
The opening of a JSON object. Written using JsonWriter.beginObject() + and read using JsonReader.beginObject(). +

+

+
+
+
+ +

+END_OBJECT

+
+public static final JsonToken END_OBJECT
+
+
The closing of a JSON object. Written using JsonWriter.endObject() + and read using JsonReader.endObject(). +

+

+
+
+
+ +

+NAME

+
+public static final JsonToken NAME
+
+
A JSON property name. Within objects, tokens alternate between names and + their values. Written using JsonWriter.name(java.lang.String) and read using JsonReader.nextName() +

+

+
+
+
+ +

+STRING

+
+public static final JsonToken STRING
+
+
A JSON string. +

+

+
+
+
+ +

+NUMBER

+
+public static final JsonToken NUMBER
+
+
A JSON number represented in this API by a Java double, long, or int. +

+

+
+
+
+ +

+BOOLEAN

+
+public static final JsonToken BOOLEAN
+
+
A JSON true or false. +

+

+
+
+
+ +

+NULL

+
+public static final JsonToken NULL
+
+
A JSON null. +

+

+
+
+
+ +

+END_DOCUMENT

+
+public static final JsonToken END_DOCUMENT
+
+
The end of the JSON stream. This sentinel value is returned by JsonReader.peek() to signal that the JSON-encoded value has no more + tokens. +

+

+
+
+ + + + + + + + +
+Method Detail
+ +

+values

+
+public static JsonToken[] values()
+
+
Returns an array containing the constants of this enum type, in +the order they are declared. This method may be used to iterate +over the constants as follows: +
+for (JsonToken c : JsonToken.values())
+    System.out.println(c);
+
+

+

+ +
Returns:
an array containing the constants of this enum type, in +the order they are declared
+
+
+
+ +

+valueOf

+
+public static JsonToken valueOf(String name)
+
+
Returns the enum constant of this type with the specified name. +The string must match exactly an identifier used to declare an +enum constant in this type. (Extraneous whitespace characters are +not permitted.) +

+

+
Parameters:
name - the name of the enum constant to be returned. +
Returns:
the enum constant with the specified name +
Throws: +
IllegalArgumentException - if this enum type has no constant +with the specified name +
NullPointerException - if the argument is null
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/stream/JsonWriter.html b/gson/docs/javadocs/com/google/gson/stream/JsonWriter.html new file mode 100644 index 00000000..52f9d4d4 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/stream/JsonWriter.html @@ -0,0 +1,848 @@ + + + + + + + +JsonWriter (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson.stream +
+Class JsonWriter

+
+java.lang.Object
+  extended by com.google.gson.stream.JsonWriter
+
+
+
All Implemented Interfaces:
Closeable
+
+
+
+
public final class JsonWriter
extends Object
implements Closeable
+ + +

+Writes a JSON (RFC 4627) + encoded value to a stream, one token at a time. The stream includes both + literal values (strings, numbers, booleans and nulls) as well as the begin + and end delimiters of objects and arrays. + +

Encoding JSON

+ To encode your data as JSON, create a new JsonWriter. Each JSON + document must contain one top-level array or object. Call methods on the + writer as you walk the structure's contents, nesting arrays and objects as + necessary: + + +

Example

+ Suppose we'd like to encode a stream of messages such as the following:
 [
+   {
+     "id": 912345678901,
+     "text": "How do I stream JSON in Java?",
+     "geo": null,
+     "user": {
+       "name": "json_newb",
+       "followers_count": 41
+      }
+   },
+   {
+     "id": 912345678902,
+     "text": "@json_newb just use JsonWriter!",
+     "geo": [50.454722, -104.606667],
+     "user": {
+       "name": "jesse",
+       "followers_count": 2
+     }
+   }
+ ]
+ This code encodes the above structure:
   public void writeJsonStream(OutputStream out, List<Message> messages) throws IOException {
+     JsonWriter writer = new JsonWriter(new OutputStreamWriter(out, "UTF-8"));
+     writer.setIndentSpaces(4);
+     writeMessagesArray(writer, messages);
+     writer.close();
+   }
+
+   public void writeMessagesArray(JsonWriter writer, List<Message> messages) throws IOException {
+     writer.beginArray();
+     for (Message message : messages) {
+       writeMessage(writer, message);
+     }
+     writer.endArray();
+   }
+
+   public void writeMessage(JsonWriter writer, Message message) throws IOException {
+     writer.beginObject();
+     writer.name("id").value(message.getId());
+     writer.name("text").value(message.getText());
+     if (message.getGeo() != null) {
+       writer.name("geo");
+       writeDoublesArray(writer, message.getGeo());
+     } else {
+       writer.name("geo").nullValue();
+     }
+     writer.name("user");
+     writeUser(writer, message.getUser());
+     writer.endObject();
+   }
+
+   public void writeUser(JsonWriter writer, User user) throws IOException {
+     writer.beginObject();
+     writer.name("name").value(user.getName());
+     writer.name("followers_count").value(user.getFollowersCount());
+     writer.endObject();
+   }
+
+   public void writeDoublesArray(JsonWriter writer, List<Double> doubles) throws IOException {
+     writer.beginArray();
+     for (Double value : doubles) {
+       writer.value(value);
+     }
+     writer.endArray();
+   }
+ +

Each JsonWriter may be used to write a single JSON stream. + Instances of this class are not thread safe. Calls that would result in a + malformed JSON string will fail with an IllegalStateException. +

+ +

+

+
Since:
+
1.6
+
Author:
+
Jesse Wilson
+
+
+ +

+ + + + + + + + + + + +
+Constructor Summary
JsonWriter(Writer out) + +
+          Creates a new instance that writes a JSON-encoded stream to out.
+  + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+Method Summary
+ JsonWriterbeginArray() + +
+          Begins encoding a new array.
+ JsonWriterbeginObject() + +
+          Begins encoding a new object.
+ voidclose() + +
+          Flushes and closes this writer and the underlying Writer.
+ JsonWriterendArray() + +
+          Ends encoding the current array.
+ JsonWriterendObject() + +
+          Ends encoding the current object.
+ voidflush() + +
+          Ensures all buffered data is written to the underlying Writer + and flushes that writer.
+ booleanisHtmlSafe() + +
+          Returns true if this writer writes JSON that's safe for inclusion in HTML + and XML documents.
+ booleanisLenient() + +
+          Returns true if this writer has relaxed syntax rules.
+ JsonWritername(String name) + +
+          Encodes the property name.
+ JsonWriternullValue() + +
+          Encodes null.
+ voidsetHtmlSafe(boolean htmlSafe) + +
+          Configure this writer to emit JSON that's safe for direct inclusion in HTML + and XML documents.
+ voidsetIndent(String indent) + +
+          Sets the indentation string to be repeated for each level of indentation + in the encoded document.
+ voidsetLenient(boolean lenient) + +
+          Configure this writer to relax its syntax rules.
+ JsonWritervalue(boolean value) + +
+          Encodes value.
+ JsonWritervalue(double value) + +
+          Encodes value.
+ JsonWritervalue(long value) + +
+          Encodes value.
+ JsonWritervalue(Number value) + +
+          Encodes value.
+ JsonWritervalue(String value) + +
+          Encodes value.
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+JsonWriter

+
+public JsonWriter(Writer out)
+
+
Creates a new instance that writes a JSON-encoded stream to out. + For best performance, ensure Writer is buffered; wrapping in + BufferedWriter if necessary. +

+

+ + + + + + + + +
+Method Detail
+ +

+setIndent

+
+public void setIndent(String indent)
+
+
Sets the indentation string to be repeated for each level of indentation + in the encoded document. If indent.isEmpty() the encoded document + will be compact. Otherwise the encoded document will be more + human-readable. +

+

+
+
+
+
Parameters:
indent - a string containing only whitespace.
+
+
+
+ +

+setLenient

+
+public void setLenient(boolean lenient)
+
+
Configure this writer to relax its syntax rules. By default, this writer + only emits well-formed JSON as specified by RFC 4627. Setting the writer + to lenient permits the following: + +

+

+
+
+
+
+
+
+
+ +

+isLenient

+
+public boolean isLenient()
+
+
Returns true if this writer has relaxed syntax rules. +

+

+
+
+
+
+
+
+
+ +

+setHtmlSafe

+
+public void setHtmlSafe(boolean htmlSafe)
+
+
Configure this writer to emit JSON that's safe for direct inclusion in HTML + and XML documents. This escapes the HTML characters <, >, + & and = before writing them to the stream. Without this + setting, your XML/HTML encoder should replace these characters with the + corresponding escape sequences. +

+

+
+
+
+
+
+
+
+ +

+isHtmlSafe

+
+public boolean isHtmlSafe()
+
+
Returns true if this writer writes JSON that's safe for inclusion in HTML + and XML documents. +

+

+
+
+
+
+
+
+
+ +

+beginArray

+
+public JsonWriter beginArray()
+                      throws IOException
+
+
Begins encoding a new array. Each call to this method must be paired with + a call to endArray(). +

+

+
+
+
+ +
Returns:
this writer. +
Throws: +
IOException
+
+
+
+ +

+endArray

+
+public JsonWriter endArray()
+                    throws IOException
+
+
Ends encoding the current array. +

+

+
+
+
+ +
Returns:
this writer. +
Throws: +
IOException
+
+
+
+ +

+beginObject

+
+public JsonWriter beginObject()
+                       throws IOException
+
+
Begins encoding a new object. Each call to this method must be paired + with a call to endObject(). +

+

+
+
+
+ +
Returns:
this writer. +
Throws: +
IOException
+
+
+
+ +

+endObject

+
+public JsonWriter endObject()
+                     throws IOException
+
+
Ends encoding the current object. +

+

+
+
+
+ +
Returns:
this writer. +
Throws: +
IOException
+
+
+
+ +

+name

+
+public JsonWriter name(String name)
+                throws IOException
+
+
Encodes the property name. +

+

+
+
+
+
Parameters:
name - the name of the forthcoming value. May not be null. +
Returns:
this writer. +
Throws: +
IOException
+
+
+
+ +

+value

+
+public JsonWriter value(String value)
+                 throws IOException
+
+
Encodes value. +

+

+
+
+
+
Parameters:
value - the literal string value, or null to encode a null literal. +
Returns:
this writer. +
Throws: +
IOException
+
+
+
+ +

+nullValue

+
+public JsonWriter nullValue()
+                     throws IOException
+
+
Encodes null. +

+

+
+
+
+ +
Returns:
this writer. +
Throws: +
IOException
+
+
+
+ +

+value

+
+public JsonWriter value(boolean value)
+                 throws IOException
+
+
Encodes value. +

+

+
+
+
+ +
Returns:
this writer. +
Throws: +
IOException
+
+
+
+ +

+value

+
+public JsonWriter value(double value)
+                 throws IOException
+
+
Encodes value. +

+

+
+
+
+
Parameters:
value - a finite value. May not be NaNs or + infinities. +
Returns:
this writer. +
Throws: +
IOException
+
+
+
+ +

+value

+
+public JsonWriter value(long value)
+                 throws IOException
+
+
Encodes value. +

+

+
+
+
+ +
Returns:
this writer. +
Throws: +
IOException
+
+
+
+ +

+value

+
+public JsonWriter value(Number value)
+                 throws IOException
+
+
Encodes value. +

+

+
+
+
+
Parameters:
value - a finite value. May not be NaNs or + infinities. +
Returns:
this writer. +
Throws: +
IOException
+
+
+
+ +

+flush

+
+public void flush()
+           throws IOException
+
+
Ensures all buffered data is written to the underlying Writer + and flushes that writer. +

+

+
+
+
+ +
Throws: +
IOException
+
+
+
+ +

+close

+
+public void close()
+           throws IOException
+
+
Flushes and closes this writer and the underlying Writer. +

+

+
Specified by:
close in interface Closeable
+
+
+ +
Throws: +
IOException - if the JSON document is incomplete.
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/stream/MalformedJsonException.html b/gson/docs/javadocs/com/google/gson/stream/MalformedJsonException.html new file mode 100644 index 00000000..bd02ab7e --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/stream/MalformedJsonException.html @@ -0,0 +1,277 @@ + + + + + + + +MalformedJsonException (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+ +

+ +com.google.gson.stream +
+Class MalformedJsonException

+
+java.lang.Object
+  extended by java.lang.Throwable
+      extended by java.lang.Exception
+          extended by java.io.IOException
+              extended by com.google.gson.stream.MalformedJsonException
+
+
+
All Implemented Interfaces:
Serializable
+
+
+
+
public final class MalformedJsonException
extends IOException
+ + +

+Thrown when a reader encounters malformed JSON. Some syntax errors can be + ignored by calling JsonReader.setLenient(boolean). +

+ +

+

+
See Also:
Serialized Form
+
+ +

+ + + + + + + + + + + + + + + + + +
+Constructor Summary
MalformedJsonException(String msg) + +
+           
MalformedJsonException(String msg, + Throwable throwable) + +
+           
MalformedJsonException(Throwable throwable) + +
+           
+  + + + + + + + +
+Method Summary
+ + + + + + + +
Methods inherited from class java.lang.Throwable
fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
+ + + + + + + +
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
+  +

+ + + + + + + + +
+Constructor Detail
+ +

+MalformedJsonException

+
+public MalformedJsonException(String msg)
+
+
+
+ +

+MalformedJsonException

+
+public MalformedJsonException(String msg,
+                              Throwable throwable)
+
+
+
+ +

+MalformedJsonException

+
+public MalformedJsonException(Throwable throwable)
+
+
+ +
+ + + + + + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/stream/class-use/JsonReader.html b/gson/docs/javadocs/com/google/gson/stream/class-use/JsonReader.html new file mode 100644 index 00000000..6b4bd537 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/stream/class-use/JsonReader.html @@ -0,0 +1,199 @@ + + + + + + + +Uses of Class com.google.gson.stream.JsonReader (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.stream.JsonReader

+
+ + + + + + + + + +
+Packages that use JsonReader
com.google.gsonThis package provides the Gson class to convert Json to Java and + vice-versa. 
+  +

+ + + + + +
+Uses of JsonReader in com.google.gson
+  +

+ + + + + + + + + + + + + +
Methods in com.google.gson with parameters of type JsonReader
+ + + + + +
+<T> T
+
Gson.fromJson(JsonReader reader, + Type typeOfT) + +
+          Reads the next JSON value from reader and convert it to an object + of type typeOfT.
+ JsonElementJsonParser.parse(JsonReader json) + +
+          Returns the next value from the JSON stream as a parse tree.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/stream/class-use/JsonToken.html b/gson/docs/javadocs/com/google/gson/stream/class-use/JsonToken.html new file mode 100644 index 00000000..7c32942d --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/stream/class-use/JsonToken.html @@ -0,0 +1,198 @@ + + + + + + + +Uses of Class com.google.gson.stream.JsonToken (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.stream.JsonToken

+
+ + + + + + + + + +
+Packages that use JsonToken
com.google.gson.stream  
+  +

+ + + + + +
+Uses of JsonToken in com.google.gson.stream
+  +

+ + + + + + + + + + + + + + + + + +
Methods in com.google.gson.stream that return JsonToken
+ JsonTokenJsonReader.peek() + +
+          Returns the type of the next token without consuming it.
+static JsonTokenJsonToken.valueOf(String name) + +
+          Returns the enum constant of this type with the specified name.
+static JsonToken[]JsonToken.values() + +
+          Returns an array containing the constants of this enum type, in +the order they are declared.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/stream/class-use/JsonWriter.html b/gson/docs/javadocs/com/google/gson/stream/class-use/JsonWriter.html new file mode 100644 index 00000000..673c2150 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/stream/class-use/JsonWriter.html @@ -0,0 +1,303 @@ + + + + + + + +Uses of Class com.google.gson.stream.JsonWriter (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.stream.JsonWriter

+
+ + + + + + + + + + + + + +
+Packages that use JsonWriter
com.google.gsonThis package provides the Gson class to convert Json to Java and + vice-versa. 
com.google.gson.stream  
+  +

+ + + + + +
+Uses of JsonWriter in com.google.gson
+  +

+ + + + + + + + + + + + + +
Methods in com.google.gson with parameters of type JsonWriter
+ voidGson.toJson(JsonElement jsonElement, + JsonWriter writer) + +
+          Writes the JSON for jsonElement to writer.
+ voidGson.toJson(Object src, + Type typeOfSrc, + JsonWriter writer) + +
+          Writes the JSON representation of src of type typeOfSrc to + writer.
+  +

+ + + + + +
+Uses of JsonWriter in com.google.gson.stream
+  +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Methods in com.google.gson.stream that return JsonWriter
+ JsonWriterJsonWriter.beginArray() + +
+          Begins encoding a new array.
+ JsonWriterJsonWriter.beginObject() + +
+          Begins encoding a new object.
+ JsonWriterJsonWriter.endArray() + +
+          Ends encoding the current array.
+ JsonWriterJsonWriter.endObject() + +
+          Ends encoding the current object.
+ JsonWriterJsonWriter.name(String name) + +
+          Encodes the property name.
+ JsonWriterJsonWriter.nullValue() + +
+          Encodes null.
+ JsonWriterJsonWriter.value(boolean value) + +
+          Encodes value.
+ JsonWriterJsonWriter.value(double value) + +
+          Encodes value.
+ JsonWriterJsonWriter.value(long value) + +
+          Encodes value.
+ JsonWriterJsonWriter.value(Number value) + +
+          Encodes value.
+ JsonWriterJsonWriter.value(String value) + +
+          Encodes value.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/stream/class-use/MalformedJsonException.html b/gson/docs/javadocs/com/google/gson/stream/class-use/MalformedJsonException.html new file mode 100644 index 00000000..63c320a9 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/stream/class-use/MalformedJsonException.html @@ -0,0 +1,145 @@ + + + + + + + +Uses of Class com.google.gson.stream.MalformedJsonException (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Class
com.google.gson.stream.MalformedJsonException

+
+No usage of com.google.gson.stream.MalformedJsonException +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/stream/package-frame.html b/gson/docs/javadocs/com/google/gson/stream/package-frame.html new file mode 100644 index 00000000..dbf87229 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/stream/package-frame.html @@ -0,0 +1,57 @@ + + + + + + + +com.google.gson.stream (Gson 1.6 API) + + + + + + + + + + + +com.google.gson.stream + + + + +
+Classes  + +
+JsonReader +
+JsonWriter
+ + + + + + +
+Enums  + +
+JsonToken
+ + + + + + +
+Exceptions  + +
+MalformedJsonException
+ + + + diff --git a/gson/docs/javadocs/com/google/gson/stream/package-summary.html b/gson/docs/javadocs/com/google/gson/stream/package-summary.html new file mode 100644 index 00000000..95aa6154 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/stream/package-summary.html @@ -0,0 +1,192 @@ + + + + + + + +com.google.gson.stream (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+

+Package com.google.gson.stream +

+ + + + + + + + + + + + + +
+Class Summary
JsonReaderReads a JSON (RFC 4627) + encoded value as a stream of tokens.
JsonWriterWrites a JSON (RFC 4627) + encoded value to a stream, one token at a time.
+  + +

+ + + + + + + + + +
+Enum Summary
JsonTokenA structure, name or value type in a JSON-encoded string.
+  + +

+ + + + + + + + + +
+Exception Summary
MalformedJsonExceptionThrown when a reader encounters malformed JSON.
+  + +

+

+
+
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/stream/package-tree.html b/gson/docs/javadocs/com/google/gson/stream/package-tree.html new file mode 100644 index 00000000..f1989870 --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/stream/package-tree.html @@ -0,0 +1,173 @@ + + + + + + + +com.google.gson.stream Class Hierarchy (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For Package com.google.gson.stream +

+
+
+
Package Hierarchies:
All Packages
+
+

+Class Hierarchy +

+ +

+Enum Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/com/google/gson/stream/package-use.html b/gson/docs/javadocs/com/google/gson/stream/package-use.html new file mode 100644 index 00000000..65d0b57e --- /dev/null +++ b/gson/docs/javadocs/com/google/gson/stream/package-use.html @@ -0,0 +1,206 @@ + + + + + + + +Uses of Package com.google.gson.stream (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Uses of Package
com.google.gson.stream

+
+ + + + + + + + + + + + + +
+Packages that use com.google.gson.stream
com.google.gsonThis package provides the Gson class to convert Json to Java and + vice-versa. 
com.google.gson.stream  
+  +

+ + + + + + + + + + + +
+Classes in com.google.gson.stream used by com.google.gson
JsonReader + +
+          Reads a JSON (RFC 4627) + encoded value as a stream of tokens.
JsonWriter + +
+          Writes a JSON (RFC 4627) + encoded value to a stream, one token at a time.
+  +

+ + + + + + + + + + + +
+Classes in com.google.gson.stream used by com.google.gson.stream
JsonToken + +
+          A structure, name or value type in a JSON-encoded string.
JsonWriter + +
+          Writes a JSON (RFC 4627) + encoded value to a stream, one token at a time.
+  +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/constant-values.html b/gson/docs/javadocs/constant-values.html new file mode 100644 index 00000000..e54e672f --- /dev/null +++ b/gson/docs/javadocs/constant-values.html @@ -0,0 +1,147 @@ + + + + + + + +Constant Field Values (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Constant Field Values

+
+
+Contents + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/deprecated-list.html b/gson/docs/javadocs/deprecated-list.html new file mode 100644 index 00000000..ff95ea2a --- /dev/null +++ b/gson/docs/javadocs/deprecated-list.html @@ -0,0 +1,147 @@ + + + + + + + +Deprecated List (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Deprecated API

+
+
+Contents + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/help-doc.html b/gson/docs/javadocs/help-doc.html new file mode 100644 index 00000000..abcf7608 --- /dev/null +++ b/gson/docs/javadocs/help-doc.html @@ -0,0 +1,224 @@ + + + + + + + +API Help (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+How This API Document Is Organized

+
+This API (Application Programming Interface) document has pages corresponding to the items in the navigation bar, described as follows.

+Overview

+
+ +

+The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.

+

+Package

+
+ +

+Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain four categories:

+
+

+Class/Interface

+
+ +

+Each class, interface, nested class and nested interface has its own separate page. Each of these pages has three sections consisting of a class/interface description, summary tables, and detailed member descriptions:

+Each summary entry contains the first sentence from the detailed description for that item. The summary entries are alphabetical, while the detailed descriptions are in the order they appear in the source code. This preserves the logical groupings established by the programmer.
+ +

+Annotation Type

+
+ +

+Each annotation type has its own separate page with the following sections:

+
+ +

+Enum

+
+ +

+Each enum has its own separate page with the following sections:

+
+

+Use

+
+Each documented package, class and interface has its own Use page. This page describes what packages, classes, methods, constructors and fields use any part of the given class or package. Given a class or interface A, its Use page includes subclasses of A, fields declared as A, methods that return A, and methods and constructors with parameters of type A. You can access this page by first going to the package, class or interface, then clicking on the "Use" link in the navigation bar.
+

+Tree (Class Hierarchy)

+
+There is a Class Hierarchy page for all packages, plus a hierarchy for each package. Each hierarchy page contains a list of classes and a list of interfaces. The classes are organized by inheritance structure starting with java.lang.Object. The interfaces do not inherit from java.lang.Object. +
+

+Deprecated API

+
+The Deprecated API page lists all of the API that have been deprecated. A deprecated API is not recommended for use, generally due to improvements, and a replacement API is usually given. Deprecated APIs may be removed in future implementations.
+

+Index

+
+The Index contains an alphabetic list of all classes, interfaces, constructors, methods, and fields.
+

+Prev/Next

+These links take you to the next or previous class, interface, package, or related page.

+Frames/No Frames

+These links show and hide the HTML frames. All pages are available with or without frames. +

+

+Serialized Form

+Each serializable or externalizable class has a description of its serialization fields and methods. This information is of interest to re-implementors, not to developers using the API. While there is no link in the navigation bar, you can get to this information by going to any serialized class and clicking "Serialized Form" in the "See also" section of the class description. +

+

+Constant Field Values

+The Constant Field Values page lists the static final fields and their values. +

+ + +This help file applies to API documentation generated using the standard doclet. + +
+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/index-all.html b/gson/docs/javadocs/index-all.html new file mode 100644 index 00000000..7ba29076 --- /dev/null +++ b/gson/docs/javadocs/index-all.html @@ -0,0 +1,917 @@ + + + + + + + +Index (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +A B C D E F G H I J L M N P R S T U V
+

+A

+
+
add(JsonElement) - +Method in class com.google.gson.JsonArray +
Adds the specified element to self. +
add(String, JsonElement) - +Method in class com.google.gson.JsonObject +
Adds a member, which is a name-value pair, to self. +
addAll(JsonArray) - +Method in class com.google.gson.JsonArray +
Adds all the elements of the specified array to self. +
addProperty(String, String) - +Method in class com.google.gson.JsonObject +
Convenience method to add a primitive member. +
addProperty(String, Number) - +Method in class com.google.gson.JsonObject +
Convenience method to add a primitive member. +
addProperty(String, Boolean) - +Method in class com.google.gson.JsonObject +
Convenience method to add a boolean member. +
addProperty(String, Character) - +Method in class com.google.gson.JsonObject +
Convenience method to add a char member. +
+
+

+B

+
+
beginArray() - +Method in class com.google.gson.stream.JsonReader +
Consumes the next token from the JSON stream and asserts that it is the + beginning of a new array. +
beginArray() - +Method in class com.google.gson.stream.JsonWriter +
Begins encoding a new array. +
beginObject() - +Method in class com.google.gson.stream.JsonReader +
Consumes the next token from the JSON stream and asserts that it is the + beginning of a new object. +
beginObject() - +Method in class com.google.gson.stream.JsonWriter +
Begins encoding a new object. +
+
+

+C

+
+
close() - +Method in class com.google.gson.stream.JsonReader +
Closes this JSON reader and the underlying Reader. +
close() - +Method in class com.google.gson.stream.JsonWriter +
Flushes and closes this writer and the underlying Writer. +
com.google.gson - package com.google.gson
This package provides the Gson class to convert Json to Java and + vice-versa.
com.google.gson.annotations - package com.google.gson.annotations
This package provides annotations that can be used with Gson.
com.google.gson.reflect - package com.google.gson.reflect
This package provides utility classes for finding type information for generic types.
com.google.gson.stream - package com.google.gson.stream
 
create() - +Method in class com.google.gson.GsonBuilder +
Creates a Gson instance based on the current configuration. +
createInstance(Type) - +Method in interface com.google.gson.InstanceCreator +
Gson invokes this call-back method during deserialization to create an instance of the + specified type. +
+
+

+D

+
+
deserialize(JsonElement, Type) - +Method in interface com.google.gson.JsonDeserializationContext +
Invokes default deserialization on the specified object. +
deserialize(JsonElement, Type, JsonDeserializationContext) - +Method in interface com.google.gson.JsonDeserializer +
Gson invokes this call-back method during deserialization when it encounters a field of the + specified type. +
disableHtmlEscaping() - +Method in class com.google.gson.GsonBuilder +
By default, Gson escapes HTML characters such as < > etc. +
disableInnerClassSerialization() - +Method in class com.google.gson.GsonBuilder +
Configures Gson to exclude inner classes during serialization. +
+
+

+E

+
+
endArray() - +Method in class com.google.gson.stream.JsonReader +
Consumes the next token from the JSON stream and asserts that it is the + end of the current array. +
endArray() - +Method in class com.google.gson.stream.JsonWriter +
Ends encoding the current array. +
endObject() - +Method in class com.google.gson.stream.JsonReader +
Consumes the next token from the JSON stream and asserts that it is the + end of the current array. +
endObject() - +Method in class com.google.gson.stream.JsonWriter +
Ends encoding the current object. +
entrySet() - +Method in class com.google.gson.JsonObject +
Returns a set of members of this object. +
equals(Object) - +Method in class com.google.gson.JsonNull +
All instances of JsonNull are the same +
equals(Object) - +Method in class com.google.gson.JsonPrimitive +
  +
equals(Object) - +Method in class com.google.gson.reflect.TypeToken +
Method to test equality. +
excludeFieldsWithModifiers(int...) - +Method in class com.google.gson.GsonBuilder +
Configures Gson to excludes all class fields that have the specified modifiers. +
excludeFieldsWithoutExposeAnnotation() - +Method in class com.google.gson.GsonBuilder +
Configures Gson to exclude all fields from consideration for serialization or deserialization + that do not have the Expose annotation. +
ExclusionStrategy - Interface in com.google.gson
A strategy (or policy) definition that is used to decide whether or not a field or top-level + class should be serialized or deserialized as part of the JSON output/input.
Expose - Annotation Type in com.google.gson.annotations
An annotation that indicates this member should be exposed for JSON + serialization or deserialization.
+
+

+F

+
+
FieldAttributes - Class in com.google.gson
A data object that stores attributes of a field.
FieldNamingPolicy - Enum in com.google.gson
An enumeration that defines a few standard naming conventions for JSON field names.
FieldNamingStrategy - Interface in com.google.gson
A mechanism for providing custom field naming in Gson.
flush() - +Method in class com.google.gson.stream.JsonWriter +
Ensures all buffered data is written to the underlying Writer + and flushes that writer. +
fromJson(String, Class<T>) - +Method in class com.google.gson.Gson +
This method deserializes the specified Json into an object of the specified class. +
fromJson(String, Type) - +Method in class com.google.gson.Gson +
This method deserializes the specified Json into an object of the specified type. +
fromJson(Reader, Class<T>) - +Method in class com.google.gson.Gson +
This method deserializes the Json read from the specified reader into an object of the + specified class. +
fromJson(Reader, Type) - +Method in class com.google.gson.Gson +
This method deserializes the Json read from the specified reader into an object of the + specified type. +
fromJson(JsonReader, Type) - +Method in class com.google.gson.Gson +
Reads the next JSON value from reader and convert it to an object + of type typeOfT. +
fromJson(JsonElement, Class<T>) - +Method in class com.google.gson.Gson +
This method deserializes the Json read from the specified parse tree into an object of the + specified type. +
fromJson(JsonElement, Type) - +Method in class com.google.gson.Gson +
This method deserializes the Json read from the specified parse tree into an object of the + specified type. +
+
+

+G

+
+
generateNonExecutableJson() - +Method in class com.google.gson.GsonBuilder +
Makes the output JSON non-executable in Javascript by prefixing the generated JSON with some + special text. +
get(int) - +Method in class com.google.gson.JsonArray +
Returns the ith element of the array. +
get(String) - +Method in class com.google.gson.JsonObject +
Returns the member with the specified name. +
get(Type) - +Static method in class com.google.gson.reflect.TypeToken +
Gets type token for the given Type instance. +
get(Class<T>) - +Static method in class com.google.gson.reflect.TypeToken +
Gets type token for the given Class instance. +
getAnnotation(Class<T>) - +Method in class com.google.gson.FieldAttributes +
Return the T annotation object from this field if it exist; otherwise returns + null. +
getAnnotations() - +Method in class com.google.gson.FieldAttributes +
Return the annotations that are present on this field. +
getAsBigDecimal() - +Method in class com.google.gson.JsonArray +
convenience method to get this array as a BigDecimal if it contains a single element. +
getAsBigDecimal() - +Method in class com.google.gson.JsonElement +
convenience method to get this element as a BigDecimal. +
getAsBigDecimal() - +Method in class com.google.gson.JsonPrimitive +
convenience method to get this element as a BigDecimal. +
getAsBigInteger() - +Method in class com.google.gson.JsonArray +
convenience method to get this array as a BigInteger if it contains a single element. +
getAsBigInteger() - +Method in class com.google.gson.JsonElement +
convenience method to get this element as a BigInteger. +
getAsBigInteger() - +Method in class com.google.gson.JsonPrimitive +
convenience method to get this element as a BigInteger. +
getAsBoolean() - +Method in class com.google.gson.JsonArray +
convenience method to get this array as a boolean if it contains a single element. +
getAsBoolean() - +Method in class com.google.gson.JsonElement +
convenience method to get this element as a boolean value. +
getAsBoolean() - +Method in class com.google.gson.JsonPrimitive +
convenience method to get this element as a boolean value. +
getAsByte() - +Method in class com.google.gson.JsonArray +
  +
getAsByte() - +Method in class com.google.gson.JsonElement +
convenience method to get this element as a primitive byte value. +
getAsByte() - +Method in class com.google.gson.JsonPrimitive +
  +
getAsCharacter() - +Method in class com.google.gson.JsonArray +
  +
getAsCharacter() - +Method in class com.google.gson.JsonElement +
convenience method to get this element as a primitive character value. +
getAsCharacter() - +Method in class com.google.gson.JsonPrimitive +
  +
getAsDouble() - +Method in class com.google.gson.JsonArray +
convenience method to get this array as a double if it contains a single element. +
getAsDouble() - +Method in class com.google.gson.JsonElement +
convenience method to get this element as a primitive double value. +
getAsDouble() - +Method in class com.google.gson.JsonPrimitive +
convenience method to get this element as a primitive double. +
getAsFloat() - +Method in class com.google.gson.JsonArray +
convenience method to get this array as a float if it contains a single element. +
getAsFloat() - +Method in class com.google.gson.JsonElement +
convenience method to get this element as a primitive float value. +
getAsFloat() - +Method in class com.google.gson.JsonPrimitive +
convenience method to get this element as a float. +
getAsInt() - +Method in class com.google.gson.JsonArray +
convenience method to get this array as an integer if it contains a single element. +
getAsInt() - +Method in class com.google.gson.JsonElement +
convenience method to get this element as a primitive integer value. +
getAsInt() - +Method in class com.google.gson.JsonPrimitive +
convenience method to get this element as a primitive integer. +
getAsJsonArray() - +Method in class com.google.gson.JsonElement +
convenience method to get this element as a JsonArray. +
getAsJsonArray(String) - +Method in class com.google.gson.JsonObject +
Convenience method to get the specified member as a JsonArray. +
getAsJsonNull() - +Method in class com.google.gson.JsonElement +
convenience method to get this element as a JsonNull. +
getAsJsonObject() - +Method in class com.google.gson.JsonElement +
convenience method to get this element as a JsonObject. +
getAsJsonObject(String) - +Method in class com.google.gson.JsonObject +
Convenience method to get the specified member as a JsonObject. +
getAsJsonPrimitive() - +Method in class com.google.gson.JsonElement +
convenience method to get this element as a JsonPrimitive. +
getAsJsonPrimitive(String) - +Method in class com.google.gson.JsonObject +
Convenience method to get the specified member as a JsonPrimitive element. +
getAsLong() - +Method in class com.google.gson.JsonArray +
convenience method to get this array as a long if it contains a single element. +
getAsLong() - +Method in class com.google.gson.JsonElement +
convenience method to get this element as a primitive long value. +
getAsLong() - +Method in class com.google.gson.JsonPrimitive +
convenience method to get this element as a primitive long. +
getAsNumber() - +Method in class com.google.gson.JsonArray +
convenience method to get this array as a Number if it contains a single element. +
getAsNumber() - +Method in class com.google.gson.JsonElement +
convenience method to get this element as a Number. +
getAsNumber() - +Method in class com.google.gson.JsonPrimitive +
convenience method to get this element as a Number. +
getAsShort() - +Method in class com.google.gson.JsonArray +
convenience method to get this array as a primitive short if it contains a single element. +
getAsShort() - +Method in class com.google.gson.JsonElement +
convenience method to get this element as a primitive short value. +
getAsShort() - +Method in class com.google.gson.JsonPrimitive +
convenience method to get this element as a primitive short. +
getAsString() - +Method in class com.google.gson.JsonArray +
convenience method to get this array as a String if it contains a single element. +
getAsString() - +Method in class com.google.gson.JsonElement +
convenience method to get this element as a string value. +
getAsString() - +Method in class com.google.gson.JsonPrimitive +
convenience method to get this element as a String. +
getDeclaredClass() - +Method in class com.google.gson.FieldAttributes +
Returns the Class<?> object that was declared for this field. +
getDeclaredType() - +Method in class com.google.gson.FieldAttributes +
For example, assume the following class definition: +
+ public class Foo {
+   private String bar;
+   private List<String> red;
+ }
+
+ Type listParmeterizedType = new TypeToken>() {}.getType();
+
getDeclaringClass() - +Method in class com.google.gson.FieldAttributes +
  +
getName() - +Method in class com.google.gson.FieldAttributes +
  +
getRawType() - +Method in class com.google.gson.reflect.TypeToken +
Gets the raw type. +
getType() - +Method in class com.google.gson.reflect.TypeToken +
Gets underlying Type instance. +
Gson - Class in com.google.gson
This is the main class for using Gson.
Gson() - +Constructor for class com.google.gson.Gson +
Constructs a Gson object with default configuration. +
GsonBuilder - Class in com.google.gson
Use this builder to construct a Gson instance when you need to set configuration + options other than the default.
GsonBuilder() - +Constructor for class com.google.gson.GsonBuilder +
Creates a GsonBuilder instance that can be used to build Gson with various configuration + settings. +
+
+

+H

+
+
has(String) - +Method in class com.google.gson.JsonObject +
Convenience method to check if a member with the specified name is present in this object. +
hashCode() - +Method in class com.google.gson.JsonNull +
All instances of JsonNull have the same hash code since they are indistinguishable +
hashCode() - +Method in class com.google.gson.JsonPrimitive +
  +
hashCode() - +Method in class com.google.gson.reflect.TypeToken +
Hashcode for this object. +
hasModifier(int) - +Method in class com.google.gson.FieldAttributes +
Returns true if the field is defined with the modifier. +
hasNext() - +Method in class com.google.gson.JsonStreamParser +
Returns true if a JsonElement is available on the input for consumption +
hasNext() - +Method in class com.google.gson.stream.JsonReader +
Returns true if the current array or object has another element. +
+
+

+I

+
+
InstanceCreator<T> - Interface in com.google.gson
This interface is implemented to create instances of a class that does not define a no-args + constructor.
isAssignableFrom(Class<?>) - +Method in class com.google.gson.reflect.TypeToken +
Check if this type is assignable from the given class object. +
isAssignableFrom(Type) - +Method in class com.google.gson.reflect.TypeToken +
Check if this type is assignable from the given Type. +
isAssignableFrom(TypeToken<?>) - +Method in class com.google.gson.reflect.TypeToken +
Check if this type is assignable from the given type token. +
isBoolean() - +Method in class com.google.gson.JsonPrimitive +
Check whether this primitive contains a boolean value. +
isHtmlSafe() - +Method in class com.google.gson.stream.JsonWriter +
Returns true if this writer writes JSON that's safe for inclusion in HTML + and XML documents. +
isJsonArray() - +Method in class com.google.gson.JsonElement +
provides check for verifying if this element is an array or not. +
isJsonNull() - +Method in class com.google.gson.JsonElement +
provides check for verifying if this element represents a null value or not. +
isJsonObject() - +Method in class com.google.gson.JsonElement +
provides check for verifying if this element is a Json object or not. +
isJsonPrimitive() - +Method in class com.google.gson.JsonElement +
provides check for verifying if this element is a primitive or not. +
isLenient() - +Method in class com.google.gson.stream.JsonReader +
Returns true if this parser is liberal in what it accepts. +
isLenient() - +Method in class com.google.gson.stream.JsonWriter +
Returns true if this writer has relaxed syntax rules. +
isNumber() - +Method in class com.google.gson.JsonPrimitive +
Check whether this primitive contains a Number. +
isString() - +Method in class com.google.gson.JsonPrimitive +
Check whether this primitive contains a String value. +
iterator() - +Method in class com.google.gson.JsonArray +
Returns an iterator to navigate the elemetns of the array. +
+
+

+J

+
+
JsonArray - Class in com.google.gson
A class representing an array type in Json.
JsonArray() - +Constructor for class com.google.gson.JsonArray +
Creates an empty JsonArray. +
JsonDeserializationContext - Interface in com.google.gson
Context for deserialization that is passed to a custom deserializer during invocation of its + JsonDeserializer.deserialize(JsonElement, Type, JsonDeserializationContext) + method.
JsonDeserializer<T> - Interface in com.google.gson
Interface representing a custom deserializer for Json.
JsonElement - Class in com.google.gson
A class representing an element of Json.
JsonElement() - +Constructor for class com.google.gson.JsonElement +
  +
JsonIOException - Exception in com.google.gson
This exception is raised when Gson was unable to read an input stream + or write to one.
JsonIOException(String) - +Constructor for exception com.google.gson.JsonIOException +
  +
JsonIOException(String, Throwable) - +Constructor for exception com.google.gson.JsonIOException +
  +
JsonIOException(Throwable) - +Constructor for exception com.google.gson.JsonIOException +
Creates exception with the specified cause. +
JsonNull - Class in com.google.gson
A class representing a Json null value.
JsonNull() - +Constructor for class com.google.gson.JsonNull +
Creates a new JsonNull object. +
JsonObject - Class in com.google.gson
A class representing an object type in Json.
JsonObject() - +Constructor for class com.google.gson.JsonObject +
Creates an empty JsonObject. +
JsonParseException - Exception in com.google.gson
This exception is raised if there is a serious issue that occurs during parsing of a Json + string.
JsonParseException(String) - +Constructor for exception com.google.gson.JsonParseException +
Creates exception with the specified message. +
JsonParseException(String, Throwable) - +Constructor for exception com.google.gson.JsonParseException +
Creates exception with the specified message and cause. +
JsonParseException(Throwable) - +Constructor for exception com.google.gson.JsonParseException +
Creates exception with the specified cause. +
JsonParser - Class in com.google.gson
A parser to parse Json into a parse tree of JsonElements
JsonParser() - +Constructor for class com.google.gson.JsonParser +
  +
JsonPrimitive - Class in com.google.gson
A class representing a Json primitive value.
JsonPrimitive(Boolean) - +Constructor for class com.google.gson.JsonPrimitive +
Create a primitive containing a boolean value. +
JsonPrimitive(Number) - +Constructor for class com.google.gson.JsonPrimitive +
Create a primitive containing a Number. +
JsonPrimitive(String) - +Constructor for class com.google.gson.JsonPrimitive +
Create a primitive containing a String value. +
JsonPrimitive(Character) - +Constructor for class com.google.gson.JsonPrimitive +
Create a primitive containing a character. +
JsonReader - Class in com.google.gson.stream
Reads a JSON (RFC 4627) + encoded value as a stream of tokens.
JsonReader(Reader) - +Constructor for class com.google.gson.stream.JsonReader +
Creates a new instance that reads a JSON-encoded stream from in. +
JsonSerializationContext - Interface in com.google.gson
Context for serialization that is passed to a custom serializer during invocation of its + JsonSerializer.serialize(Object, Type, JsonSerializationContext) method.
JsonSerializer<T> - Interface in com.google.gson
Interface representing a custom serializer for Json.
JsonStreamParser - Class in com.google.gson
A streaming parser that allows reading of multiple JsonElements from the specified reader + asynchronously.
JsonStreamParser(String) - +Constructor for class com.google.gson.JsonStreamParser +
  +
JsonStreamParser(Reader) - +Constructor for class com.google.gson.JsonStreamParser +
  +
JsonSyntaxException - Exception in com.google.gson
This exception is raised when Gson attempts to read (or write) a malformed + JSON element.
JsonSyntaxException(String) - +Constructor for exception com.google.gson.JsonSyntaxException +
  +
JsonSyntaxException(String, Throwable) - +Constructor for exception com.google.gson.JsonSyntaxException +
  +
JsonSyntaxException(Throwable) - +Constructor for exception com.google.gson.JsonSyntaxException +
Creates exception with the specified cause. +
JsonToken - Enum in com.google.gson.stream
A structure, name or value type in a JSON-encoded string.
JsonWriter - Class in com.google.gson.stream
Writes a JSON (RFC 4627) + encoded value to a stream, one token at a time.
JsonWriter(Writer) - +Constructor for class com.google.gson.stream.JsonWriter +
Creates a new instance that writes a JSON-encoded stream to out. +
+
+

+L

+
+
LongSerializationPolicy - Enum in com.google.gson
Defines the expected format for a long or Long type when its serialized.
+
+

+M

+
+
MalformedJsonException - Exception in com.google.gson.stream
Thrown when a reader encounters malformed JSON.
MalformedJsonException(String) - +Constructor for exception com.google.gson.stream.MalformedJsonException +
  +
MalformedJsonException(String, Throwable) - +Constructor for exception com.google.gson.stream.MalformedJsonException +
  +
MalformedJsonException(Throwable) - +Constructor for exception com.google.gson.stream.MalformedJsonException +
  +
+
+

+N

+
+
name(String) - +Method in class com.google.gson.stream.JsonWriter +
Encodes the property name. +
next() - +Method in class com.google.gson.JsonStreamParser +
Returns the next available JsonElement on the reader. +
nextBoolean() - +Method in class com.google.gson.stream.JsonReader +
Returns the boolean value of the next token, + consuming it. +
nextDouble() - +Method in class com.google.gson.stream.JsonReader +
Returns the double value of the next token, + consuming it. +
nextInt() - +Method in class com.google.gson.stream.JsonReader +
Returns the int value of the next token, + consuming it. +
nextLong() - +Method in class com.google.gson.stream.JsonReader +
Returns the long value of the next token, + consuming it. +
nextName() - +Method in class com.google.gson.stream.JsonReader +
Returns the next token, a property name, and + consumes it. +
nextNull() - +Method in class com.google.gson.stream.JsonReader +
Consumes the next token from the JSON stream and asserts that it is a + literal null. +
nextString() - +Method in class com.google.gson.stream.JsonReader +
Returns the string value of the next token, + consuming it. +
nullValue() - +Method in class com.google.gson.stream.JsonWriter +
Encodes null. +
+
+

+P

+
+
parse(String) - +Method in class com.google.gson.JsonParser +
Parses the specified JSON string into a parse tree +
parse(Reader) - +Method in class com.google.gson.JsonParser +
Parses the specified JSON string into a parse tree +
parse(JsonReader) - +Method in class com.google.gson.JsonParser +
Returns the next value from the JSON stream as a parse tree. +
peek() - +Method in class com.google.gson.stream.JsonReader +
Returns the type of the next token without consuming it. +
+
+

+R

+
+
registerTypeAdapter(Type, Object) - +Method in class com.google.gson.GsonBuilder +
Configures Gson for custom serialization or deserialization. +
remove(String) - +Method in class com.google.gson.JsonObject +
Removes the property from this JsonObject. +
remove() - +Method in class com.google.gson.JsonStreamParser +
This optional Iterator method is not relevant for stream parsing and hence is not + implemented. +
+
+

+S

+
+
serialize(Object) - +Method in interface com.google.gson.JsonSerializationContext +
Invokes default serialization on the specified object. +
serialize(Object, Type) - +Method in interface com.google.gson.JsonSerializationContext +
Invokes default serialization on the specified object passing the specific type information. +
serialize(T, Type, JsonSerializationContext) - +Method in interface com.google.gson.JsonSerializer +
Gson invokes this call-back method during serialization when it encounters a field of the + specified type. +
serialize(Long) - +Method in enum com.google.gson.LongSerializationPolicy +
Serialize this value using this serialization policy. +
SerializedName - Annotation Type in com.google.gson.annotations
An annotation that indicates this member should be serialized to JSON with + the provided name value as its field name.
serializeNulls() - +Method in class com.google.gson.GsonBuilder +
Configure Gson to serialize null fields. +
serializeSpecialFloatingPointValues() - +Method in class com.google.gson.GsonBuilder +
Section 2.4 of JSON specification disallows + special double values (NaN, Infinity, -Infinity). +
setDateFormat(String) - +Method in class com.google.gson.GsonBuilder +
Configures Gson to serialize Date objects according to the pattern provided. +
setDateFormat(int) - +Method in class com.google.gson.GsonBuilder +
Configures Gson to to serialize Date objects according to the style value provided. +
setDateFormat(int, int) - +Method in class com.google.gson.GsonBuilder +
Configures Gson to to serialize Date objects according to the style value provided. +
setExclusionStrategies(ExclusionStrategy...) - +Method in class com.google.gson.GsonBuilder +
Configures Gson to apply a set of exclusion strategies during both serialization and + deserialization. +
setFieldNamingPolicy(FieldNamingPolicy) - +Method in class com.google.gson.GsonBuilder +
Configures Gson to apply a specific naming policy to an object's field during serialization + and deserialization. +
setFieldNamingStrategy(FieldNamingStrategy) - +Method in class com.google.gson.GsonBuilder +
Configures Gson to apply a specific naming policy strategy to an object's field during + serialization and deserialization. +
setHtmlSafe(boolean) - +Method in class com.google.gson.stream.JsonWriter +
Configure this writer to emit JSON that's safe for direct inclusion in HTML + and XML documents. +
setIndent(String) - +Method in class com.google.gson.stream.JsonWriter +
Sets the indentation string to be repeated for each level of indentation + in the encoded document. +
setLenient(boolean) - +Method in class com.google.gson.stream.JsonReader +
Configure this parser to be be liberal in what it accepts. +
setLenient(boolean) - +Method in class com.google.gson.stream.JsonWriter +
Configure this writer to relax its syntax rules. +
setLongSerializationPolicy(LongSerializationPolicy) - +Method in class com.google.gson.GsonBuilder +
Configures Gson to apply a specific serialization policy for Long and long + objects. +
setPrettyPrinting() - +Method in class com.google.gson.GsonBuilder +
Configures Gson to output Json that fits in a page for pretty printing. +
setVersion(double) - +Method in class com.google.gson.GsonBuilder +
Configures Gson to enable versioning support. +
shouldSkipClass(Class<?>) - +Method in interface com.google.gson.ExclusionStrategy +
  +
shouldSkipField(FieldAttributes) - +Method in interface com.google.gson.ExclusionStrategy +
  +
Since - Annotation Type in com.google.gson.annotations
An annotation that indicates the version number since a member or a type has been present.
size() - +Method in class com.google.gson.JsonArray +
Returns the number of elements in the array. +
skipValue() - +Method in class com.google.gson.stream.JsonReader +
Skips the next value recursively. +
+
+

+T

+
+
toJson(Object) - +Method in class com.google.gson.Gson +
This method serializes the specified object into its equivalent Json representation. +
toJson(Object, Type) - +Method in class com.google.gson.Gson +
This method serializes the specified object, including those of generic types, into its + equivalent Json representation. +
toJson(Object, Appendable) - +Method in class com.google.gson.Gson +
This method serializes the specified object into its equivalent Json representation. +
toJson(Object, Type, Appendable) - +Method in class com.google.gson.Gson +
This method serializes the specified object, including those of generic types, into its + equivalent Json representation. +
toJson(Object, Type, JsonWriter) - +Method in class com.google.gson.Gson +
Writes the JSON representation of src of type typeOfSrc to + writer. +
toJson(JsonElement) - +Method in class com.google.gson.Gson +
Converts a tree of JsonElements into its equivalent JSON representation. +
toJson(JsonElement, Appendable) - +Method in class com.google.gson.Gson +
Writes out the equivalent JSON for a tree of JsonElements. +
toJson(JsonElement, JsonWriter) - +Method in class com.google.gson.Gson +
Writes the JSON for jsonElement to writer. +
toJsonTree(Object) - +Method in class com.google.gson.Gson +
This method serializes the specified object into its equivalent representation as a tree of + JsonElements. +
toJsonTree(Object, Type) - +Method in class com.google.gson.Gson +
This method serializes the specified object, including those of generic types, into its + equivalent representation as a tree of JsonElements. +
toString() - +Method in class com.google.gson.Gson +
  +
toString() - +Method in class com.google.gson.JsonElement +
Returns a String representation of this element. +
toString() - +Method in class com.google.gson.reflect.TypeToken +
Returns a string representation of this object. +
toString() - +Method in class com.google.gson.stream.JsonReader +
  +
translateName(Field) - +Method in interface com.google.gson.FieldNamingStrategy +
Translates the field name into its JSON field name representation. +
TypeToken<T> - Class in com.google.gson.reflect
Represents a generic type T.
+
+

+U

+
+
Until - Annotation Type in com.google.gson.annotations
An annotation that indicates the version number until a member or a type should be present.
+
+

+V

+
+
value(String) - +Method in class com.google.gson.stream.JsonWriter +
Encodes value. +
value(boolean) - +Method in class com.google.gson.stream.JsonWriter +
Encodes value. +
value(double) - +Method in class com.google.gson.stream.JsonWriter +
Encodes value. +
value(long) - +Method in class com.google.gson.stream.JsonWriter +
Encodes value. +
value(Number) - +Method in class com.google.gson.stream.JsonWriter +
Encodes value. +
valueOf(String) - +Static method in enum com.google.gson.FieldNamingPolicy +
Returns the enum constant of this type with the specified name. +
valueOf(String) - +Static method in enum com.google.gson.LongSerializationPolicy +
Returns the enum constant of this type with the specified name. +
valueOf(String) - +Static method in enum com.google.gson.stream.JsonToken +
Returns the enum constant of this type with the specified name. +
values() - +Static method in enum com.google.gson.FieldNamingPolicy +
Returns an array containing the constants of this enum type, in +the order they are declared. +
values() - +Static method in enum com.google.gson.LongSerializationPolicy +
Returns an array containing the constants of this enum type, in +the order they are declared. +
values() - +Static method in enum com.google.gson.stream.JsonToken +
Returns an array containing the constants of this enum type, in +the order they are declared. +
+
+A B C D E F G H I J L M N P R S T U V + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/index.html b/gson/docs/javadocs/index.html new file mode 100644 index 00000000..d40633ca --- /dev/null +++ b/gson/docs/javadocs/index.html @@ -0,0 +1,40 @@ + + + + + + + +Gson 1.6 API + + + + + + + + + + + +<H2> +Frame Alert</H2> + +<P> +This document is designed to be viewed using the frames feature. If you see this message, you are using a non-frame-capable web client. +<BR> +Link to<A HREF="overview-summary.html">Non-frame version.</A> + + + diff --git a/gson/docs/javadocs/overview-frame.html b/gson/docs/javadocs/overview-frame.html new file mode 100644 index 00000000..3b9cafe4 --- /dev/null +++ b/gson/docs/javadocs/overview-frame.html @@ -0,0 +1,49 @@ + + + + + + + +Overview List (Gson 1.6 API) + + + + + + + + + + + + + + + +
+
+ + + + + +
All Classes +

+ +Packages +
+com.google.gson +
+com.google.gson.annotations +
+com.google.gson.reflect +
+com.google.gson.stream +
+

+ +

+  + + diff --git a/gson/docs/javadocs/overview-summary.html b/gson/docs/javadocs/overview-summary.html new file mode 100644 index 00000000..c3cbd72f --- /dev/null +++ b/gson/docs/javadocs/overview-summary.html @@ -0,0 +1,170 @@ + + + + + + + +Overview (Gson 1.6 API) + + + + + + + + + + + + +


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Gson 1.6 API +

+
+ + + + + + + + + + + + + + + + + + + + + +
+Packages
com.google.gsonThis package provides the Gson class to convert Json to Java and + vice-versa.
com.google.gson.annotationsThis package provides annotations that can be used with Gson.
com.google.gson.reflectThis package provides utility classes for finding type information for generic types.
com.google.gson.stream 
+ +


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/overview-tree.html b/gson/docs/javadocs/overview-tree.html new file mode 100644 index 00000000..ed66be46 --- /dev/null +++ b/gson/docs/javadocs/overview-tree.html @@ -0,0 +1,194 @@ + + + + + + + +Class Hierarchy (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Hierarchy For All Packages

+
+
+
Package Hierarchies:
com.google.gson, com.google.gson.annotations, com.google.gson.reflect, com.google.gson.stream
+
+

+Class Hierarchy +

+ +

+Interface Hierarchy +

+ +

+Annotation Type Hierarchy +

+ +

+Enum Hierarchy +

+ +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/package-list b/gson/docs/javadocs/package-list new file mode 100644 index 00000000..cdd3c1da --- /dev/null +++ b/gson/docs/javadocs/package-list @@ -0,0 +1,4 @@ +com.google.gson +com.google.gson.annotations +com.google.gson.reflect +com.google.gson.stream diff --git a/gson/docs/javadocs/resources/inherit.gif b/gson/docs/javadocs/resources/inherit.gif new file mode 100644 index 00000000..c814867a Binary files /dev/null and b/gson/docs/javadocs/resources/inherit.gif differ diff --git a/gson/docs/javadocs/serialized-form.html b/gson/docs/javadocs/serialized-form.html new file mode 100644 index 00000000..d3ab7829 --- /dev/null +++ b/gson/docs/javadocs/serialized-form.html @@ -0,0 +1,217 @@ + + + + + + + +Serialized Form (Gson 1.6 API) + + + + + + + + + + + + +
+ + + + + + + + + + + + + + + +
+ +
+ + + +
+
+

+Serialized Form

+
+
+ + + + + +
+Package com.google.gson
+ +

+ + + + + +
+Class com.google.gson.JsonIOException extends JsonParseException implements Serializable
+ +

+serialVersionUID: 1L + +

+ +

+ + + + + +
+Class com.google.gson.JsonParseException extends RuntimeException implements Serializable
+ +

+serialVersionUID: -4086729973971783390L + +

+ +

+ + + + + +
+Class com.google.gson.JsonSyntaxException extends JsonParseException implements Serializable
+ +

+serialVersionUID: 1L + +

+


+ + + + + +
+Package com.google.gson.stream
+ +

+ + + + + +
+Class com.google.gson.stream.MalformedJsonException extends IOException implements Serializable
+ +

+serialVersionUID: 1L + +

+ +

+


+ + + + + + + + + + + + + + + +
+ +
+ + + +
+Copyright © 2008-2010. All Rights Reserved. + + diff --git a/gson/docs/javadocs/stylesheet.css b/gson/docs/javadocs/stylesheet.css new file mode 100644 index 00000000..6ea9e516 --- /dev/null +++ b/gson/docs/javadocs/stylesheet.css @@ -0,0 +1,29 @@ +/* Javadoc style sheet */ + +/* Define colors, fonts and other style attributes here to override the defaults */ + +/* Page background color */ +body { background-color: #FFFFFF; color:#000000 } + +/* Headings */ +h1 { font-size: 145% } + +/* Table colors */ +.TableHeadingColor { background: #CCCCFF; color:#000000 } /* Dark mauve */ +.TableSubHeadingColor { background: #EEEEFF; color:#000000 } /* Light mauve */ +.TableRowColor { background: #FFFFFF; color:#000000 } /* White */ + +/* Font used in left-hand frame lists */ +.FrameTitleFont { font-size: 100%; font-family: Helvetica, Arial, sans-serif; color:#000000 } +.FrameHeadingFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 } +.FrameItemFont { font-size: 90%; font-family: Helvetica, Arial, sans-serif; color:#000000 } + +/* Navigation bar fonts and colors */ +.NavBarCell1 { background-color:#EEEEFF; color:#000000} /* Light mauve */ +.NavBarCell1Rev { background-color:#00008B; color:#FFFFFF} /* Dark Blue */ +.NavBarFont1 { font-family: Arial, Helvetica, sans-serif; color:#000000;color:#000000;} +.NavBarFont1Rev { font-family: Arial, Helvetica, sans-serif; color:#FFFFFF;color:#FFFFFF;} + +.NavBarCell2 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} +.NavBarCell3 { font-family: Arial, Helvetica, sans-serif; background-color:#FFFFFF; color:#000000} +