Skip to content

Commit 2fe4674

Browse files
committed
Remove Gson.excluder() exposing internal Excluder class
1 parent fe30b85 commit 2fe4674

File tree

2 files changed

+18
-5
lines changed

2 files changed

+18
-5
lines changed

gson/src/main/java/com/google/gson/Gson.java

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -299,18 +299,31 @@ public GsonBuilder newBuilder() {
299299
return new GsonBuilder(this);
300300
}
301301

302-
public Excluder excluder() {
303-
return excluder;
304-
}
305-
302+
/**
303+
* Returns the field naming strategy used by this Gson instance.
304+
*
305+
* @see GsonBuilder#setFieldNamingStrategy(FieldNamingStrategy)
306+
*/
306307
public FieldNamingStrategy fieldNamingStrategy() {
307308
return fieldNamingStrategy;
308309
}
309310

311+
/**
312+
* Returns whether this Gson instance is serializing JSON object properties with
313+
* {@code null} values, or just omits them.
314+
*
315+
* @see GsonBuilder#serializeNulls()
316+
*/
310317
public boolean serializeNulls() {
311318
return serializeNulls;
312319
}
313320

321+
/**
322+
* Returns whether this Gson instance produces JSON output which is
323+
* HTML-safe, that means all HTML characters are escaped.
324+
*
325+
* @see GsonBuilder#disableHtmlEscaping()
326+
*/
314327
public boolean htmlSafe() {
315328
return htmlSafe;
316329
}

gson/src/test/java/com/google/gson/GsonTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public void testOverridesDefaultExcluder() {
5555
new ArrayList<TypeAdapterFactory>(), new ArrayList<TypeAdapterFactory>(),
5656
CUSTOM_OBJECT_TO_NUMBER_STRATEGY, CUSTOM_NUMBER_TO_NUMBER_STRATEGY);
5757

58-
assertEquals(CUSTOM_EXCLUDER, gson.excluder());
58+
assertEquals(CUSTOM_EXCLUDER, gson.excluder);
5959
assertEquals(CUSTOM_FIELD_NAMING_STRATEGY, gson.fieldNamingStrategy());
6060
assertEquals(true, gson.serializeNulls());
6161
assertEquals(false, gson.htmlSafe());

0 commit comments

Comments
 (0)