diff --git a/gson/src/main/java/com/google/gson/ExclusionStrategy.java b/gson/src/main/java/com/google/gson/ExclusionStrategy.java index d2f90b24..9ea4ab8e 100644 --- a/gson/src/main/java/com/google/gson/ExclusionStrategy.java +++ b/gson/src/main/java/com/google/gson/ExclusionStrategy.java @@ -19,8 +19,8 @@ package 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. For serialization, - * if the {@link this#shouldSkipClass(Class)} method returns false then that class or field type - * will not be part of the JSON output. For deserialization, if {@link this#shouldSkipClass(Class)} + * if the {@link #shouldSkipClass(Class)} method returns false then that class or field type + * will not be part of the JSON output. For deserialization, if {@link #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.
diff --git a/gson/src/main/java/com/google/gson/FieldAttributes.java b/gson/src/main/java/com/google/gson/FieldAttributes.java
index fcac2f4b..76aa5e88 100644
--- a/gson/src/main/java/com/google/gson/FieldAttributes.java
+++ b/gson/src/main/java/com/google/gson/FieldAttributes.java
@@ -90,7 +90,7 @@ final class FieldAttributes {
}
/**
- * Return the {@link T} annotation object from this field if it exist; otherwise returns
+ * Return the T annotation object from this field if it exist; otherwise returns
* {@code null}.
*
* @param annotation the class of the annotation that will be retrieved
diff --git a/gson/src/main/java/com/google/gson/Gson.java b/gson/src/main/java/com/google/gson/Gson.java
index 941e5bcf..4c03c2bd 100644
--- a/gson/src/main/java/com/google/gson/Gson.java
+++ b/gson/src/main/java/com/google/gson/Gson.java
@@ -202,7 +202,7 @@ public final class Gson {
if (src == null) {
return JsonNull.createJsonNull();
}
- return toJsonTree(src, src.getClass(), false);
+ return toJsonTree(src, src.getClass());
}
/**
@@ -222,16 +222,12 @@ public final class Gson {
* @since 1.4
*/
public JsonElement toJsonTree(Object src, Type typeOfSrc) {
- return toJsonTree(src, typeOfSrc, true);
- }
-
- private JsonElement toJsonTree(Object src, Type typeOfSrc, boolean preserveType) {
if (src == null) {
return JsonNull.createJsonNull();
}
JsonSerializationContextDefault context = new JsonSerializationContextDefault(
createDefaultObjectNavigatorFactory(serializationStrategy), serializeNulls, serializers);
- return context.serialize(src, typeOfSrc, preserveType);
+ return context.serialize(src, typeOfSrc, true);
}
/**
@@ -251,7 +247,7 @@ public final class Gson {
if (src == null) {
return serializeNulls ? NULL_STRING : "";
}
- return toJson(src, src.getClass(), false);
+ return toJson(src, src.getClass());
}
/**
@@ -270,12 +266,8 @@ public final class Gson {
* @return Json representation of {@code src}
*/
public String toJson(Object src, Type typeOfSrc) {
- return toJson(src, typeOfSrc, true);
- }
-
- private String toJson(Object src, Type typeOfSrc, boolean preserveType) {
StringWriter writer = new StringWriter();
- toJson(src, typeOfSrc, writer, preserveType);
+ toJson(src, typeOfSrc, writer);
return writer.toString();
}
@@ -295,7 +287,7 @@ public final class Gson {
public void toJson(Object src, Appendable writer) {
try {
if (src != null) {
- toJson(src, src.getClass(), writer, false);
+ toJson(src, src.getClass(), writer);
} else if (serializeNulls) {
writeOutNullString(writer);
}
@@ -320,11 +312,7 @@ public final class Gson {
* @since 1.2
*/
public void toJson(Object src, Type typeOfSrc, Appendable writer) {
- toJson(src, typeOfSrc, writer, true);
- }
-
- private void toJson(Object src, Type typeOfSrc, Appendable writer, boolean preserveType) {
- JsonElement jsonElement = toJsonTree(src, typeOfSrc, preserveType);
+ JsonElement jsonElement = toJsonTree(src, typeOfSrc);
toJson(jsonElement, writer);
}
diff --git a/gson/src/main/java/com/google/gson/JsonDeserializationVisitor.java b/gson/src/main/java/com/google/gson/JsonDeserializationVisitor.java
index 95bb6e75..88132108 100644
--- a/gson/src/main/java/com/google/gson/JsonDeserializationVisitor.java
+++ b/gson/src/main/java/com/google/gson/JsonDeserializationVisitor.java
@@ -98,8 +98,4 @@ abstract class JsonDeserializationVisitor