Skip to content

Commit

Permalink
Expose newJsonWriter wrapper instead of just options.
Browse files Browse the repository at this point in the history
This is more future proof to ensure that consumers holding on to TypeAdapters for efficiency can always encode JSON in the same way as if the Gson instance was used directly.
  • Loading branch information
JakeWharton committed Sep 26, 2015
1 parent 31f80d8 commit e81f3eb
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions gson/src/main/java/com/google/gson/Gson.java
Original file line number Diff line number Diff line change
Expand Up @@ -247,11 +247,6 @@ public Gson() {
this.factories = Collections.unmodifiableList(factories);
}

/** Returns true if this Gson instance writes fields with null values. */
public boolean serializeNulls() {
return serializeNulls;
}

private TypeAdapter<Number> doubleAdapter(boolean serializeSpecialFloatingPointValues) {
if (serializeSpecialFloatingPointValues) {
return TypeAdapters.DOUBLE;
Expand Down Expand Up @@ -648,10 +643,9 @@ public void toJson(JsonElement jsonElement, Appendable writer) throws JsonIOExce
}

/**
* Returns a new JSON writer configured for this GSON and with the non-execute
* prefix if that is configured.
* Returns a new JSON writer configured for the settings on this Gson instance.
*/
private JsonWriter newJsonWriter(Writer writer) throws IOException {
public JsonWriter newJsonWriter(Writer writer) throws IOException {
if (generateNonExecutableJson) {
writer.write(JSON_NON_EXECUTABLE_PREFIX);
}
Expand Down

0 comments on commit e81f3eb

Please sign in to comment.