From ff2c8f8e8b118278947755898cb6c75dfc7e90ff Mon Sep 17 00:00:00 2001 From: jwilson Date: Mon, 7 Sep 2015 22:31:43 -0400 Subject: [PATCH] Expose serializeNulls with an accessor. Useful for frameworks that build on Gson. --- gson/src/main/java/com/google/gson/Gson.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gson/src/main/java/com/google/gson/Gson.java b/gson/src/main/java/com/google/gson/Gson.java index 844188ac..a2709d3a 100644 --- a/gson/src/main/java/com/google/gson/Gson.java +++ b/gson/src/main/java/com/google/gson/Gson.java @@ -246,6 +246,11 @@ public final class Gson { this.factories = Collections.unmodifiableList(factories); } + /** Returns true if this Gson instance writes fields with null values. */ + public boolean serializeNulls() { + return serializeNulls; + } + private TypeAdapter doubleAdapter(boolean serializeSpecialFloatingPointValues) { if (serializeSpecialFloatingPointValues) { return TypeAdapters.DOUBLE;