@@ -51,28 +51,28 @@ class SimpleValueOutput(
51
51
def this (consumer : Any => Unit ) =
52
52
this (consumer, new MHashMap [String , Any ], new ListBuffer [Any ])
53
53
54
- def writeNull (): Unit = consumer(null )
55
- def writeBoolean (boolean : Boolean ): Unit = consumer(boolean)
56
- def writeString (str : String ): Unit = consumer(str)
57
- def writeInt (int : Int ): Unit = consumer(int)
58
- def writeLong (long : Long ): Unit = consumer(long)
59
- def writeDouble (double : Double ): Unit = consumer(double)
60
- def writeBigInt (bigInt : BigInt ): Unit = consumer(bigInt)
61
- def writeBigDecimal (bigDecimal : BigDecimal ): Unit = consumer(bigDecimal)
62
- def writeBinary (binary : Array [Byte ]): Unit = consumer(binary)
54
+ override def writeNull (): Unit = consumer(null )
55
+ override def writeBoolean (boolean : Boolean ): Unit = consumer(boolean)
56
+ override def writeString (str : String ): Unit = consumer(str)
57
+ override def writeInt (int : Int ): Unit = consumer(int)
58
+ override def writeLong (long : Long ): Unit = consumer(long)
59
+ override def writeDouble (double : Double ): Unit = consumer(double)
60
+ override def writeBigInt (bigInt : BigInt ): Unit = consumer(bigInt)
61
+ override def writeBigDecimal (bigDecimal : BigDecimal ): Unit = consumer(bigDecimal)
62
+ override def writeBinary (binary : Array [Byte ]): Unit = consumer(binary)
63
63
64
64
def writeList (): ListOutput = new ListOutput {
65
65
private val buffer = newListRepr
66
66
override def declareSize (size : Int ): Unit = buffer.sizeHint(size)
67
- def writeElement () = new SimpleValueOutput (buffer += _, newObjectRepr, newListRepr)
68
- def finish (): Unit = consumer(buffer.result())
67
+ override def writeElement (): SimpleValueOutput = new SimpleValueOutput (buffer += _, newObjectRepr, newListRepr)
68
+ override def finish (): Unit = consumer(buffer.result())
69
69
}
70
70
71
71
def writeObject (): ObjectOutput = new ObjectOutput {
72
72
private val result = newObjectRepr
73
73
override def declareSize (size : Int ): Unit = result.sizeHint(size)
74
- def writeField (key : String ) = new SimpleValueOutput (v => result += ((key, v)), newObjectRepr, newListRepr)
75
- def finish (): Unit = consumer(result)
74
+ override def writeField (key : String ): SimpleValueOutput = new SimpleValueOutput (v => result += ((key, v)), newObjectRepr, newListRepr)
75
+ override def finish (): Unit = consumer(result)
76
76
}
77
77
}
78
78
@@ -95,15 +95,15 @@ class SimpleValueInput(value: Any) extends InputAndSimpleInput {
95
95
case _ => throw new ReadFailure (s " Expected ${classTag[B ].runtimeClass} but got ${value.getClass}" )
96
96
}
97
97
98
- def readNull (): Boolean = value == null
99
- def readBoolean (): Boolean = doReadUnboxed[Boolean , JBoolean ]
100
- def readString (): String = doRead[String ]
101
- def readInt (): Int = doReadUnboxed[Int , JInteger ]
102
- def readLong (): Long = doReadUnboxed[Long , JLong ]
103
- def readDouble (): Double = doReadUnboxed[Double , JDouble ]
104
- def readBigInt (): BigInt = doRead[JBigInteger ]
105
- def readBigDecimal (): BigDecimal = doRead[JBigDecimal ]
106
- def readBinary (): Array [Byte ] = doRead[Array [Byte ]]
98
+ override def readNull (): Boolean = value == null
99
+ override def readBoolean (): Boolean = doReadUnboxed[Boolean , JBoolean ]
100
+ override def readString (): String = doRead[String ]
101
+ override def readInt (): Int = doReadUnboxed[Int , JInteger ]
102
+ override def readLong (): Long = doReadUnboxed[Long , JLong ]
103
+ override def readDouble (): Double = doReadUnboxed[Double , JDouble ]
104
+ override def readBigInt (): BigInt = doRead[JBigInteger ]
105
+ override def readBigDecimal (): BigDecimal = doRead[JBigDecimal ]
106
+ override def readBinary (): Array [Byte ] = doRead[Array [Byte ]]
107
107
108
108
def readObject (): ObjectInput =
109
109
new ObjectInput {
@@ -112,22 +112,22 @@ class SimpleValueInput(value: Any) extends InputAndSimpleInput {
112
112
case (k, v) => new SimpleValueFieldInput (k, v)
113
113
}
114
114
override def knownSize : Int = if (map.isEmpty) 0 else map.knownSize
115
- def nextField (): SimpleValueFieldInput = it.next()
115
+ override def nextField (): SimpleValueFieldInput = it.next()
116
116
override def peekField (name : String ): Opt [SimpleValueFieldInput ] =
117
117
map.get(name).map(new SimpleValueFieldInput (name, _)).toOpt // values may be null!
118
- def hasNext : Boolean = it.hasNext
118
+ override def hasNext : Boolean = it.hasNext
119
119
}
120
120
121
121
def readList (): ListInput =
122
122
new ListInput {
123
123
private val inputSeq : BSeq [Any ] = doRead[BSeq [Any ]]
124
124
private val it = inputSeq.iterator.map(new SimpleValueInput (_))
125
125
override def knownSize : Int = if (inputSeq.isEmpty) 0 else inputSeq.knownSize
126
- def nextElement (): SimpleValueInput = it.next()
127
- def hasNext : Boolean = it.hasNext
126
+ override def nextElement (): SimpleValueInput = it.next()
127
+ override def hasNext : Boolean = it.hasNext
128
128
}
129
129
130
- def skip (): Unit = ()
130
+ override def skip (): Unit = ()
131
131
}
132
132
133
133
class SimpleValueFieldInput (val fieldName : String , value : Any )
0 commit comments