Made the GsonBuilder registerTypeHierarchyAdapter a public method.

Updated the Gson version number to 1.6 and added @since tag for the new classes
This commit is contained in:
Inderjeet Singh 2010-10-27 23:53:09 +00:00
parent 2d7367364b
commit 2b993d83b6
6 changed files with 9 additions and 5 deletions

View File

@ -4,7 +4,7 @@
<groupId>com.google.code.gson</groupId> <groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId> <artifactId>gson</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>1.5</version> <version>1.6</version>
<inceptionYear>2008</inceptionYear> <inceptionYear>2008</inceptionYear>
<name>Gson</name> <name>Gson</name>
<url>http://code.google.com/p/google-gson/</url> <url>http://code.google.com/p/google-gson/</url>

View File

@ -429,9 +429,9 @@ public final class GsonBuilder {
* @param typeAdapter This object must implement at least one of the {@link InstanceCreator}, * @param typeAdapter This object must implement at least one of the {@link InstanceCreator},
* {@link JsonSerializer}, and a {@link JsonDeserializer} interfaces. * {@link JsonSerializer}, and a {@link JsonDeserializer} interfaces.
* @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern * @return a reference to this {@code GsonBuilder} object to fulfill the "Builder" pattern
* @since 1.5 * @since 1.6
*/ */
GsonBuilder registerTypeHierarchyAdapter(Class<?> baseType, Object typeAdapter) { public GsonBuilder registerTypeHierarchyAdapter(Class<?> baseType, Object typeAdapter) {
Preconditions.checkArgument(typeAdapter instanceof JsonSerializer<?> Preconditions.checkArgument(typeAdapter instanceof JsonSerializer<?>
|| typeAdapter instanceof JsonDeserializer<?> || typeAdapter instanceof InstanceCreator<?>); || typeAdapter instanceof JsonDeserializer<?> || typeAdapter instanceof InstanceCreator<?>);
if (typeAdapter instanceof InstanceCreator<?>) { if (typeAdapter instanceof InstanceCreator<?>) {

View File

@ -179,8 +179,9 @@ import java.util.List;
* *
* <p>Each {@code JsonReader} may be used to read a single JSON stream. Instances * <p>Each {@code JsonReader} may be used to read a single JSON stream. Instances
* of this class are not thread safe. * of this class are not thread safe.
* *
* @author Jesse Wilson * @author Jesse Wilson
* @since 1.6
*/ */
public final class JsonReader implements Closeable { public final class JsonReader implements Closeable {

View File

@ -20,6 +20,7 @@ package com.google.gson.stream;
* Lexical scoping elements within a JSON reader or writer. * Lexical scoping elements within a JSON reader or writer.
* *
* @author Jesse Wilson * @author Jesse Wilson
* @since 1.6
*/ */
enum JsonScope { enum JsonScope {

View File

@ -20,6 +20,7 @@ package com.google.gson.stream;
* A structure, name or value type in a JSON-encoded string. * A structure, name or value type in a JSON-encoded string.
* *
* @author Jesse Wilson * @author Jesse Wilson
* @since 1.6
*/ */
public enum JsonToken { public enum JsonToken {

View File

@ -116,8 +116,9 @@ import java.util.List;
* <p>Each {@code JsonWriter} may be used to write a single JSON stream. * <p>Each {@code JsonWriter} may be used to write a single JSON stream.
* Instances of this class are not thread safe. Calls that would result in a * Instances of this class are not thread safe. Calls that would result in a
* malformed JSON string will fail with an {@link IllegalStateException}. * malformed JSON string will fail with an {@link IllegalStateException}.
* *
* @author Jesse Wilson * @author Jesse Wilson
* @since 1.6
*/ */
public final class JsonWriter implements Closeable { public final class JsonWriter implements Closeable {