Nulls are here to stay. Sigh.

This commit is contained in:
Jesse Wilson 2011-10-14 03:20:05 +00:00
parent 5db4caeec5
commit 0e02cbb33e
7 changed files with 25 additions and 25 deletions

View File

@ -282,7 +282,7 @@ public final class Gson {
return new TypeAdapter<Number>() {
@Override public Double read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}
return reader.nextDouble();
@ -306,7 +306,7 @@ public final class Gson {
return new TypeAdapter<Number>() {
@Override public Float read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}
return (float) reader.nextDouble();
@ -338,7 +338,7 @@ public final class Gson {
return new TypeAdapter<Number>() {
@Override public Number read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}
return reader.nextLong();

View File

@ -61,7 +61,7 @@ public final class ArrayTypeAdapter<E> extends TypeAdapter<Object> {
public Object read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}

View File

@ -68,7 +68,7 @@ public final class CollectionTypeAdapterFactory implements TypeAdapter.Factory {
public Collection<E> read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}

View File

@ -147,7 +147,7 @@ public final class MapTypeAdapterFactory implements TypeAdapter.Factory {
public Map<K, V> read(JsonReader reader) throws IOException {
JsonToken peek = reader.peek();
if (peek == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}

View File

@ -150,7 +150,7 @@ public class ReflectiveTypeAdapterFactory implements TypeAdapter.Factory {
@Override
public T read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}

View File

@ -74,7 +74,7 @@ public final class StringToValueMapTypeAdapterFactory implements TypeAdapter.Fac
public Map<String, V> read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}

View File

@ -112,7 +112,7 @@ public final class TypeAdapters {
@Override
public Boolean read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}
return reader.nextBoolean();
@ -134,7 +134,7 @@ public final class TypeAdapters {
@Override
public Number read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}
try {
@ -157,7 +157,7 @@ public final class TypeAdapters {
@Override
public Number read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}
try {
@ -179,7 +179,7 @@ public final class TypeAdapters {
@Override
public Number read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}
try {
@ -201,7 +201,7 @@ public final class TypeAdapters {
@Override
public Number read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}
try {
@ -223,7 +223,7 @@ public final class TypeAdapters {
@Override
public Number read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}
return (float) reader.nextDouble();
@ -241,7 +241,7 @@ public final class TypeAdapters {
@Override
public Number read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}
return reader.nextDouble();
@ -261,7 +261,7 @@ public final class TypeAdapters {
JsonToken jsonToken = reader.peek();
switch (jsonToken) {
case NULL:
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
case NUMBER:
return new LazilyParsedNumber(reader.nextString());
@ -281,7 +281,7 @@ public final class TypeAdapters {
@Override
public Character read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}
return reader.nextString().charAt(0);
@ -300,7 +300,7 @@ public final class TypeAdapters {
public String read(JsonReader reader) throws IOException {
JsonToken peek = reader.peek();
if (peek == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}
/* coerce booleans to strings for backwards compatibility */
@ -321,7 +321,7 @@ public final class TypeAdapters {
@Override
public StringBuilder read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}
return new StringBuilder(reader.nextString());
@ -339,7 +339,7 @@ public final class TypeAdapters {
@Override
public StringBuffer read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}
return new StringBuffer(reader.nextString());
@ -357,7 +357,7 @@ public final class TypeAdapters {
@Override
public URL read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}
String nextString = reader.nextString();
@ -375,7 +375,7 @@ public final class TypeAdapters {
@Override
public URI read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}
try {
@ -397,7 +397,7 @@ public final class TypeAdapters {
@Override
public InetAddress read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}
return InetAddress.getByName(reader.nextString());
@ -415,7 +415,7 @@ public final class TypeAdapters {
@Override
public UUID read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}
return java.util.UUID.fromString(reader.nextString());
@ -521,7 +521,7 @@ public final class TypeAdapters {
@Override
public Locale read(JsonReader reader) throws IOException {
if (reader.peek() == JsonToken.NULL) {
reader.nextNull(); // TODO: does this belong here?
reader.nextNull();
return null;
}
String locale = reader.nextString();