Browse files

typecast

  • Loading branch information...
1 parent 57867db commit 41535f4b490c27cdaf3463344f68eee1458d5cc2 @imikushin imikushin committed May 11, 2012
View
4 src/main/scala/com/codahale/jerkson/deser/CaseClassDeserializer.scala
@@ -8,7 +8,7 @@ import com.codahale.jerkson.Util._
import com.fasterxml.jackson.databind._
import com.fasterxml.jackson.databind.node.{ObjectNode, NullNode, TreeTraversingParser}
import com.fasterxml.jackson.databind.JavaType
-import com.fasterxml.jackson.core.{TreeNode, JsonToken, JsonParser}
+import com.fasterxml.jackson.core.{JsonToken, JsonParser}
class CaseClassDeserializer(config: DeserializationConfig,
javaType: JavaType,
@@ -45,7 +45,7 @@ class CaseClassDeserializer(config: DeserializationConfig,
throw ctxt.mappingException(javaType.getRawClass)
}
- val node = jp.readValueAsTree[TreeNode]
+ val node = jp.readValueAsTree[JsonNode]
val values = new ArrayBuffer[AnyRef]
for ((paramName, paramType) <- params) {
View
8 src/main/scala/com/codahale/jerkson/deser/RangeDeserializer.scala
@@ -17,7 +17,7 @@ class RangeDeserializer extends JsonDeserializer[Object] {
throw ctxt.mappingException(classOf[Range])
}
- val node = jp.readValueAsTree
+ val node = jp.readValueAsTree[JsonNode]
val inclusiveNode = node.get("inclusive")
val stepNode = node.get("step")
val startNode = node.get("start")
@@ -31,11 +31,11 @@ class RangeDeserializer extends JsonDeserializer[Object] {
val step = if (stepNode == null || !classOf[IntNode].isAssignableFrom(stepNode.getClass)) {
1
} else {
- stepNode.getIntValue
+ stepNode.intValue
}
- val start = startNode.asInstanceOf[IntNode].getIntValue
- val end = endNode.asInstanceOf[IntNode].getIntValue
+ val start = startNode.asInstanceOf[IntNode].intValue
+ val end = endNode.asInstanceOf[IntNode].intValue
if (inclusiveNode == null || inclusiveNode == BooleanNode.FALSE) {
Range(start, end, step)

0 comments on commit 41535f4

Please sign in to comment.