From ba283925ae8503ca72f326486a3518fb517df5b7 Mon Sep 17 00:00:00 2001 From: Inderjeet Singh Date: Fri, 9 Sep 2011 05:02:19 +0000 Subject: [PATCH] Deleted unneeded Long deserializer. --- .../com/google/gson/DefaultTypeAdapters.java | 23 ------------------- 1 file changed, 23 deletions(-) diff --git a/gson/src/main/java/com/google/gson/DefaultTypeAdapters.java b/gson/src/main/java/com/google/gson/DefaultTypeAdapters.java index b307ff5f..2870775f 100644 --- a/gson/src/main/java/com/google/gson/DefaultTypeAdapters.java +++ b/gson/src/main/java/com/google/gson/DefaultTypeAdapters.java @@ -64,7 +64,6 @@ final class DefaultTypeAdapters { private static final MapTypeAdapter MAP_TYPE_ADAPTER = new MapTypeAdapter(); private static final CharacterTypeAdapter CHARACTER_TYPE_ADAPTER = new CharacterTypeAdapter(); - private static final LongDeserializer LONG_DESERIALIZER = new LongDeserializer(); private static final NumberTypeAdapter NUMBER_TYPE_ADAPTER = new NumberTypeAdapter(); private static final GregorianCalendarTypeAdapter GREGORIAN_CALENDAR_TYPE_ADAPTER = @@ -126,8 +125,6 @@ final class DefaultTypeAdapters { // Add primitive deserializers map.register(Character.class, wrapDeserializer(CHARACTER_TYPE_ADAPTER), true); - map.register(Long.class, LONG_DESERIALIZER, true); - map.register(long.class, LONG_DESERIALIZER, true); map.register(Number.class, NUMBER_TYPE_ADAPTER, true); map.makeUnmodifiable(); @@ -515,26 +512,6 @@ final class DefaultTypeAdapters { } } - private static final class LongDeserializer implements JsonDeserializer { - public Long deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) - throws JsonParseException { - try { - return json.getAsLong(); - } catch (NumberFormatException e) { - throw new JsonSyntaxException(e); - } catch (UnsupportedOperationException e) { - throw new JsonSyntaxException(e); - } catch (IllegalStateException e) { - throw new JsonSyntaxException(e); - } - } - - @Override - public String toString() { - return LongDeserializer.class.getSimpleName(); - } - } - static final class FloatSerializer implements JsonSerializer { private final boolean serializeSpecialFloatingPointValues;