FieldNamingPolicy: Use Locale.ENGLISH to be locale insensitive

This commit is contained in:
Sebastian Chlan 2015-06-09 15:17:08 +01:00
parent 299ee89852
commit 6e57df7e96

View File

@ -17,6 +17,7 @@
package com.google.gson; package com.google.gson;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Locale;
/** /**
* An enumeration that defines a few standard naming conventions for JSON field names. * An enumeration that defines a few standard naming conventions for JSON field names.
@ -88,7 +89,7 @@ public enum FieldNamingPolicy implements FieldNamingStrategy {
*/ */
LOWER_CASE_WITH_UNDERSCORES() { LOWER_CASE_WITH_UNDERSCORES() {
public String translateName(Field f) { public String translateName(Field f) {
return separateCamelCase(f.getName(), "_").toLowerCase(); return separateCamelCase(f.getName(), "_").toLowerCase(Locale.ENGLISH);
} }
}, },
@ -111,7 +112,7 @@ public enum FieldNamingPolicy implements FieldNamingStrategy {
*/ */
LOWER_CASE_WITH_DASHES() { LOWER_CASE_WITH_DASHES() {
public String translateName(Field f) { public String translateName(Field f) {
return separateCamelCase(f.getName(), "-").toLowerCase(); return separateCamelCase(f.getName(), "-").toLowerCase(Locale.ENGLISH);
} }
}; };