Skip to content

Commit

Permalink
Remove Gson.excluder() exposing internal Excluder class
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcono1234 committed Oct 11, 2021
1 parent fe30b85 commit 2fe4674
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
21 changes: 17 additions & 4 deletions gson/src/main/java/com/google/gson/Gson.java
Original file line number Diff line number Diff line change
Expand Up @@ -299,18 +299,31 @@ public GsonBuilder newBuilder() {
return new GsonBuilder(this);
}

public Excluder excluder() {
return excluder;
}

/**
* Returns the field naming strategy used by this Gson instance.
*
* @see GsonBuilder#setFieldNamingStrategy(FieldNamingStrategy)
*/
public FieldNamingStrategy fieldNamingStrategy() {
return fieldNamingStrategy;
}

/**
* Returns whether this Gson instance is serializing JSON object properties with
* {@code null} values, or just omits them.
*
* @see GsonBuilder#serializeNulls()
*/
public boolean serializeNulls() {
return serializeNulls;
}

/**
* Returns whether this Gson instance produces JSON output which is
* HTML-safe, that means all HTML characters are escaped.
*
* @see GsonBuilder#disableHtmlEscaping()
*/
public boolean htmlSafe() {
return htmlSafe;
}
Expand Down
2 changes: 1 addition & 1 deletion gson/src/test/java/com/google/gson/GsonTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void testOverridesDefaultExcluder() {
new ArrayList<TypeAdapterFactory>(), new ArrayList<TypeAdapterFactory>(),
CUSTOM_OBJECT_TO_NUMBER_STRATEGY, CUSTOM_NUMBER_TO_NUMBER_STRATEGY);

assertEquals(CUSTOM_EXCLUDER, gson.excluder());
assertEquals(CUSTOM_EXCLUDER, gson.excluder);
assertEquals(CUSTOM_FIELD_NAMING_STRATEGY, gson.fieldNamingStrategy());
assertEquals(true, gson.serializeNulls());
assertEquals(false, gson.htmlSafe());
Expand Down

0 comments on commit 2fe4674

Please sign in to comment.