Revision: 55835
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at February 23, 2012 23:00 by Jannixx
Initial Code
/*
Project website:
https://github.com/FasterXML/jackson-datatype-hppc
Maven:
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-hppc</artifactId>
<version>2.0.0-RC1</version>
</dependency>
*/
import com.carrotsearch.hppc.ObjectObjectOpenHashMap;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.hppc.HppcModule;
// Serialize:
ObjectObjectOpenHashMap<String, ObjectDoubleOpenHashMap<String>> mapStringMapStringDouble = new ObjectObjectOpenHashMap<String, ObjectDoubleOpenHashMap<String>>();
// fill map
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new HppcModule());
mapper.writeValue(new FileOutputStream("filename-goes-here"), mapStringMapStringDouble);
// De-serialize:
ObjectMapper mapper = new ObjectMapper();
mapper.registerModule(new HppcModule());
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
ObjectObjectOpenHashMap<String, ObjectDoubleOpenHashMap<String>> mapStringMapStringDouble = mapper.readValue(inputStream, new TypeReference<ObjectObjectOpenHashMap<String, ObjectDoubleOpenHashMap<String>>>() {});
Initial URL
Initial Description
(De-)serialising an HPPC map using the jackson HPPC module.
Initial Title
Jackson HPPC serialization example
Initial Tags
Initial Language
Java