|
1 | 1 | package com.microWorkflow.jsonScalaPerftest.jackson
|
2 | 2 |
|
3 | 3 | import com.microWorkflow.jsonScalaPerftest.LibraryAdaptor
|
4 |
| -import org.codehaus.jackson.map.ObjectMapper |
5 |
| -import org.codehaus.jackson.map.DeserializationConfig |
| 4 | +import com.fasterxml.jackson.databind.ObjectMapper |
| 5 | +//import com.fasterxml.jackson.module.scala.DefaultScalaModule |
6 | 6 |
|
7 |
| -class Url { |
8 |
| - private var indices:Array[Int] = _ |
9 |
| - private var url:String = _ |
10 |
| - def getIndices = indices |
11 |
| - def setIndices(v:Array[Int]) { indices = v} |
12 |
| - def getUrl = url |
13 |
| - def setUrl(s:String) { url = s} |
14 |
| -} |
15 |
| -class HashTag { |
16 |
| - private var indices:Array[Int] = _ |
17 |
| - private var text:String = _ |
18 |
| - def getIndices = indices |
19 |
| - def setIndices(v:Array[Int]) { indices = v} |
20 |
| - def getText = text |
21 |
| - def setText(s:String) { text = s} |
22 |
| -} |
23 |
| -class UserMention { |
24 |
| - private var indices:Array[Int] = _ |
25 |
| - private var name:String = _ |
26 |
| - def getIndices = indices |
27 |
| - def setIndices(v:Array[Int]) { indices = v} |
28 |
| - def getName = name |
29 |
| - def setName(s:String) { name = s} |
30 |
| -} |
31 |
| -class Entities { |
32 |
| - private var hashtags:Array[HashTag] = _ |
33 |
| - private var urls:Array[Url] = _ |
34 |
| - private var user_mentions:Array[UserMention] = _ |
35 |
| - def getHashtags = hashtags |
36 |
| - def setHashtags(v:Array[HashTag]) { hashtags = v } |
37 |
| - def getUrls = urls |
38 |
| - def setUrls(v:Array[Url]) { urls = v } |
39 |
| - def getUser_mentions = user_mentions |
40 |
| - def setUser_mentions(v:Array[UserMention]) { user_mentions = v } |
41 |
| -} |
| 7 | +case class Url(indices: Array[Int], url: String) |
42 | 8 |
|
43 |
| -class Tweet { |
44 |
| - private var id_str:String = _ |
45 |
| - private var text:String = _ |
46 |
| - private var entities:Entities = _ |
47 |
| - def getId_str = id_str |
48 |
| - def setId_str(s:String) { id_str = s} |
49 |
| - def getText = text |
50 |
| - def setText(s:String) { text = s} |
51 |
| - def getEntities = entities |
52 |
| - def setEntities(e:Entities) { entities = e} |
53 |
| -} |
| 9 | +case class HashTag(indices: Array[Int], text:String) |
| 10 | + |
| 11 | +case class UserMention(indices: Array[Int], name: String) |
| 12 | + |
| 13 | +case class Entities(hashtags: Array[HashTag], urls:Array[Url], user_mentions:Array[UserMention]) |
| 14 | + |
| 15 | +case class Tweet(id_str: String, text: String, entities: Entities) |
54 | 16 |
|
55 | 17 | class JacksonAdaptor(name: String) extends LibraryAdaptor(name) {
|
56 | 18 |
|
57 | 19 | var m: ObjectMapper = _
|
58 | 20 |
|
59 | 21 | override def initialize() {
|
60 |
| - m = new ObjectMapper() |
61 |
| - m.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false) |
| 22 | + m = new ObjectMapper |
| 23 | +// m.registerModule(new DefaultScalaModule) |
| 24 | +// m.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false) |
62 | 25 | }
|
63 | 26 |
|
64 | 27 | override def parseOnce(json: String) = {
|
|
0 commit comments