Skip to content
This repository was archived by the owner on Oct 13, 2025. It is now read-only.

Commit 0dd3553

Browse files
authored
Merge pull request #3 from bicouy0/list-any-hashmap
use a parameterized deserializer for LIST
2 parents 36df7ae + 091af0f commit 0dd3553

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

src/main/scala/com/arangodb/velocypack/module/scala/internal/VPackScalaDeserializers.scala

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@ object VPackScalaDeserializers {
2323
}
2424
}
2525

26-
val LIST = new VPackDeserializer[List[Any]] {
26+
val LIST = new VPackDeserializerParameterizedType[List[Any]] {
2727
def deserialize(parent: VPackSlice, vpack: VPackSlice, context: VPackDeserializationContext): List[Any] =
28-
context.deserialize(vpack, classOf[java.util.List[Any]]).toList
28+
throw new UnsupportedOperationException
29+
30+
def deserialize(parent: VPackSlice, vpack: VPackSlice, context: VPackDeserializationContext, t: ParameterizedType): List[Any] = {
31+
val clazz = t.getActualTypeArguments()(0).asInstanceOf[Class[Any]]
32+
vpack.arrayIterator().map { slice => context.deserialize(slice, clazz) }.toList
33+
}
2934
}
3035

3136
val MAP = new VPackDeserializer[Map[Any, Any]] {

src/test/scala/com/arangodb/velocypack/module/scala/VPackListTest.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class VPackListTest extends FunSuite with Matchers {
5555
entity.i(0) should be(69)
5656
entity.o.size should be(1)
5757
entity.o(0) should not be null
58+
entity.o(0) shouldBe a [ListTestEntity]
5859
}
5960

60-
}
61+
}

0 commit comments

Comments
 (0)