Search in sources :

Example 1 with Version

use of com.fasterxml.jackson.core.Version in project hadoop by apache.

the class StatePool method read.

private void read(DataInput in) throws IOException {
    ObjectMapper mapper = new ObjectMapper();
    // define a module
    SimpleModule module = new SimpleModule("State Serializer", new Version(0, 1, 1, "FINAL", "", ""));
    // add the state deserializer
    module.addDeserializer(StatePair.class, new StateDeserializer());
    // register the module with the object-mapper
    mapper.registerModule(module);
    JsonParser parser = mapper.getFactory().createParser((DataInputStream) in);
    StatePool statePool = mapper.readValue(parser, StatePool.class);
    this.setStates(statePool.getStates());
    parser.close();
}
Also used : Version(com.fasterxml.jackson.core.Version) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) JsonParser(com.fasterxml.jackson.core.JsonParser)

Example 2 with Version

use of com.fasterxml.jackson.core.Version in project Gaffer by gchq.

the class HyperLogLogPlusJsonSerialisationTest method before.

@Before
public void before() {
    mapper = new ObjectMapper();
    mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
    mapper.setSerializationInclusion(JsonInclude.Include.NON_DEFAULT);
    final SimpleModule module = new SimpleModule(HyperLogLogPlusJsonConstants.HYPER_LOG_LOG_PLUS_SERIALISER_MODULE_NAME, new Version(1, 0, 0, null));
    module.addSerializer(HyperLogLogPlus.class, new HyperLogLogPlusJsonSerialiser());
    module.addDeserializer(HyperLogLogPlus.class, new HyperLogLogPlusJsonDeserialiser());
    mapper.registerModule(module);
}
Also used : Version(com.fasterxml.jackson.core.Version) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule) Before(org.junit.Before)

Example 3 with Version

use of com.fasterxml.jackson.core.Version in project midpoint by Evolveum.

the class JsonLexicalProcessor method createSerializerModule.

private Module createSerializerModule() {
    SimpleModule module = new SimpleModule("MidpointModule", new Version(0, 0, 0, "aa"));
    module.addSerializer(QName.class, new QNameSerializer());
    module.addSerializer(PolyString.class, new PolyStringSerializer());
    module.addSerializer(ItemPath.class, new ItemPathSerializer());
    module.addSerializer(ItemPathType.class, new ItemPathTypeSerializer());
    module.addSerializer(XMLGregorianCalendar.class, new XmlGregorianCalendarSerializer());
    //		module.addSerializer(JAXBElement.class, new JaxbElementSerializer());
    return module;
}
Also used : Version(com.fasterxml.jackson.core.Version) SimpleModule(com.fasterxml.jackson.databind.module.SimpleModule)

Example 4 with Version

use of com.fasterxml.jackson.core.Version in project jackson-databind by FasterXML.

the class TestVersions method assertVersion.

/*
    /**********************************************************
    /* Helper methods
    /**********************************************************
     */
private void assertVersion(Versioned vers) {
    Version v = vers.version();
    assertFalse("Should find version information (got " + v + ")", v.isUnknownVersion());
    Version exp = PackageVersion.VERSION;
    assertEquals(exp.toFullString(), v.toFullString());
    assertEquals(exp, v);
}
Also used : PackageVersion(com.fasterxml.jackson.databind.cfg.PackageVersion) Version(com.fasterxml.jackson.core.Version)

Example 5 with Version

use of com.fasterxml.jackson.core.Version in project jackson-module-afterburner by FasterXML.

the class TestVersions method assertVersion.

/*
    /**********************************************************
    /* Helper methods
    /**********************************************************
     */
private void assertVersion(Versioned vers) {
    Version v = vers.version();
    assertFalse("Should find version information (got " + v + ")", v.isUnknownVersion());
    Version exp = PackageVersion.VERSION;
    assertEquals(exp.toFullString(), v.toFullString());
    assertEquals(exp, v);
}
Also used : Version(com.fasterxml.jackson.core.Version)

Aggregations

Version (com.fasterxml.jackson.core.Version)12 SimpleModule (com.fasterxml.jackson.databind.module.SimpleModule)8 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)5 JsonFactory (com.fasterxml.jackson.core.JsonFactory)1 JsonGenerator (com.fasterxml.jackson.core.JsonGenerator)1 JsonParser (com.fasterxml.jackson.core.JsonParser)1 PackageVersion (com.fasterxml.jackson.databind.cfg.PackageVersion)1 CmsSystemCodeSerializer (gov.ca.cwds.data.CmsSystemCodeSerializer)1 IOException (java.io.IOException)1 Path (org.apache.hadoop.fs.Path)1 ID (org.apache.hadoop.mapreduce.ID)1 Before (org.junit.Before)1 Test (org.junit.Test)1 RoaringBitmap (org.roaringbitmap.RoaringBitmap)1