Permalink
Browse files

remove unnecessary deserializers (legacy from scala 2.8)

  • Loading branch information...
1 parent 41535f4 commit f751c8b801e76687b0a8656cf308ef607ecd59b7 @imikushin imikushin committed May 11, 2012
@@ -1,28 +0,0 @@
-package com.codahale.jerkson.deser
-
-import com.fasterxml.jackson.databind.JavaType
-import com.fasterxml.jackson.databind.{DeserializationContext, JsonDeserializer}
-import scala.collection.mutable.MutableList
-import com.fasterxml.jackson.core.{JsonToken, JsonParser}
-
-// TODO: 6/2/11 <coda> -- replace MutableListDeserializer with a SeqDeserializer when we drop 2.8.1
-
-/**
- * We only need this because MutableList has no generic companion in 2.8.1.
- */
-class MutableListDeserializer(elementType: JavaType,
- elementDeserializer: JsonDeserializer[Object]) extends JsonDeserializer[Object] {
- def deserialize(jp: JsonParser, ctxt: DeserializationContext) = {
- val list = new MutableList[Object]
-
- if (jp.getCurrentToken != JsonToken.START_ARRAY) {
- throw ctxt.mappingException(elementType.getRawClass)
- }
-
- while (jp.nextToken() != JsonToken.END_ARRAY) {
- list += elementDeserializer.deserialize(jp, ctxt).asInstanceOf[Object]
- }
-
- list
- }
-}
@@ -1,28 +0,0 @@
-package com.codahale.jerkson.deser
-
-import com.fasterxml.jackson.databind.JavaType
-import com.fasterxml.jackson.databind.{DeserializationContext, JsonDeserializer}
-import com.fasterxml.jackson.core.{JsonToken, JsonParser}
-import scala.collection.mutable.Queue
-
-// TODO: 6/2/11 <coda> -- replace QueueDeserializer with a SeqDeserializer when we drop 2.8.1
-
-/**
- * We only need this because Queue has no generic companion in 2.8.1.
- */
-class QueueDeserializer(elementType: JavaType,
- elementDeserializer: JsonDeserializer[Object]) extends JsonDeserializer[Object] {
- def deserialize(jp: JsonParser, ctxt: DeserializationContext) = {
- val list = new Queue[Object]
-
- if (jp.getCurrentToken != JsonToken.START_ARRAY) {
- throw ctxt.mappingException(elementType.getRawClass)
- }
-
- while (jp.nextToken() != JsonToken.END_ARRAY) {
- list += elementDeserializer.deserialize(jp, ctxt).asInstanceOf[Object]
- }
-
- list
- }
-}
@@ -34,11 +34,9 @@ class ScalaDeserializers(classLoader: ClassLoader) extends Deserializers.Base {
} else if (klass == classOf[mutable.ArraySeq[_]]) {
createSeqDeserializer(config, javaType, mutable.ArraySeq, property)
} else if (klass == classOf[mutable.MutableList[_]]) {
- val elementType = javaType.containedType(0)
- new MutableListDeserializer(elementType, provider.findTypedValueDeserializer(config, elementType, property))
+ createSeqDeserializer(config, javaType, mutable.MutableList, property)
} else if (klass == classOf[mutable.Queue[_]]) {
- val elementType = javaType.containedType(0)
- new QueueDeserializer(elementType, provider.findTypedValueDeserializer(config, elementType, property))
+ createSeqDeserializer(config, javaType, mutable.Queue, property)
} else if (klass == classOf[mutable.ListBuffer[_]]) {
createSeqDeserializer(config, javaType, mutable.ListBuffer, property)
} else if (klass == classOf[mutable.ArrayBuffer[_]] || klass == classOf[mutable.Traversable[_]]) {

0 comments on commit f751c8b

Please sign in to comment.