This project contains a Jackson extension for reading and writing VelocyPack encoded data.
To add the dependency to your project with maven, add the following code to your pom.xml:
<dependencies>
<dependency>
<groupId>com.arangodb</groupId>
<artifactId>jackson-dataformat-velocypack</artifactId>
<version>x.y.z</version>
</dependency>
</dependencies>
Just create an instance of VPackMapper
simply by:
ObjectMapper mapper = new VPackMapper();
Since version 4.5.2 the ArangoDB Java driver allows to use a custom
serializer to de-/serialize documents, edges and query results. Just create an instance of ArangoJack
and pass it to the driver through ArangoDB.Builder.serializer(ArangoSerialization)
.
ArangoDB arango = new ArangoDB.Builder().serializer(new ArangoJack()).build();
ArangoJack arangoJack = new ArangoJack();
arangoJack.configure((mapper) -> {
// your configuration here
});
ArangoDB arango = new ArangoDB.Builder().serializer(arangoJack).build();
The VPackMapper
can be configured with Jackson datatype modules
as well as Jackson JVM Language modules.
Kotlin language module enables support for Kotlin native types and can be registered in the following way:
val mapper = VPackMapper().apply {
registerModule(KotlinModule())
}
Scala language module enables support for Scala native types and can be registered in the following way:
val mapper = new VPackMapper()
mapper.registerModule(DefaultScalaModule)