com.jn.agileway.codec.serialization.cbor.CborJacksonCodec Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of agileway-codec Show documentation
Show all versions of agileway-codec Show documentation
Provide an unified codec API for hession, kryo, protostuff, fst, fes, xson, cbor, jackson, json, etc....
package com.jn.agileway.codec.serialization.cbor;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.cbor.CBORFactory;
import com.jn.agileway.codec.serialization.jackson.BasedJacksonCodec;
/**
* 基于Jackson框架实现,由于Jackson框架不支持循环依赖,因而导致 Cbor 目前的实现,不支持循环依赖。
* @param
*/
public class CborJacksonCodec extends BasedJacksonCodec {
public CborJacksonCodec() {
super(new ObjectMapper(new CBORFactory()));
}
public CborJacksonCodec(ClassLoader classLoader) {
super(createObjectMapper(classLoader, new ObjectMapper(new CBORFactory())));
}
public CborJacksonCodec(ClassLoader classLoader, CborJacksonCodec codec) {
super(createObjectMapper(classLoader, codec.objectMapper.copy()));
}
}