Address code review comments on r1154
This commit is contained in:
parent
ae9e63fc54
commit
4816941f0d
@ -250,14 +250,6 @@ public final class Gson {
|
||||
this.factories = Collections.unmodifiableList(factories);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the field naming policy used to translate Java field names to JSON
|
||||
* property names.
|
||||
*/
|
||||
public FieldNamingStrategy getFieldNamingPolicy() {
|
||||
return fieldNamingPolicy;
|
||||
}
|
||||
|
||||
private TypeAdapter<Number> doubleAdapter(boolean serializeSpecialFloatingPointValues) {
|
||||
if (serializeSpecialFloatingPointValues) {
|
||||
return TypeAdapters.DOUBLE;
|
||||
@ -414,7 +406,7 @@ public final class Gson {
|
||||
* read or written.
|
||||
* @param skipPast The type adapter factory that needs to be skipped while searching for
|
||||
* a matching type adapter. In most cases, you should just pass <i>this</i> (the type adapter
|
||||
* factory from where {@link getDelegateAdapter} method is being invoked).
|
||||
* factory from where {@link #getDelegateAdapter} method is being invoked).
|
||||
* @param type Type for which the delegate adapter is being searched for.
|
||||
*
|
||||
* @since 2.2
|
||||
|
@ -53,6 +53,7 @@ public class OverrideCoreTypeAdaptersTest extends TestCase {
|
||||
assertEquals("1", gson.toJson(true, Boolean.class));
|
||||
assertEquals(Boolean.TRUE, gson.fromJson("true", boolean.class));
|
||||
assertEquals(Boolean.TRUE, gson.fromJson("1", Boolean.class));
|
||||
assertEquals(Boolean.FALSE, gson.fromJson("0", Boolean.class));
|
||||
}
|
||||
|
||||
public void testOverridePrimitiveBooleanAdapter() {
|
||||
@ -63,6 +64,7 @@ public class OverrideCoreTypeAdaptersTest extends TestCase {
|
||||
assertEquals("true", gson.toJson(true, Boolean.class));
|
||||
assertEquals(Boolean.TRUE, gson.fromJson("1", boolean.class));
|
||||
assertEquals(Boolean.TRUE, gson.fromJson("true", Boolean.class));
|
||||
assertEquals("0", gson.toJson(false, boolean.class));
|
||||
}
|
||||
|
||||
public void testOverrideStringAdapter() {
|
||||
|
@ -47,7 +47,7 @@ public class DelegateTypeAdapterTest extends TestCase {
|
||||
.create();
|
||||
}
|
||||
|
||||
public void testDelegateInvokedOnObjectsButNotOnPrimitives() {
|
||||
public void testDelegateInvoked() {
|
||||
List<BagOfPrimitives> bags = new ArrayList<BagOfPrimitives>();
|
||||
for (int i = 0; i < 10; ++i) {
|
||||
bags.add(new BagOfPrimitives(i, i, i % 2 == 0, String.valueOf(i)));
|
||||
|
Loading…
Reference in New Issue
Block a user