Search in sources :

Example 1 with FSTClazzInfoRegistry

use of org.nustaq.serialization.FSTClazzInfoRegistry in project redisson by redisson.

the class FstCodec method copy.

private static FSTConfiguration copy(ClassLoader classLoader, FstCodec codec) {
    FSTConfiguration def = codec.config.deriveConfiguration();
    def.setClassLoader(classLoader);
    def.setCoderSpecific(codec.config.getCoderSpecific());
    def.setCrossPlatform(codec.config.isCrossPlatform());
    def.setForceClzInit(codec.config.isForceClzInit());
    def.setForceSerializable(codec.config.isForceSerializable());
    def.setInstantiator(codec.config.getInstantiator(null));
    def.setJsonFieldNames(codec.config.getJsonFieldNames());
    def.setLastResortResolver(codec.config.getLastResortResolver());
    def.setName(codec.config.getName());
    def.setPreferSpeed(codec.config.isPreferSpeed());
    def.setStructMode(codec.config.isStructMode());
    def.setShareReferences(codec.config.isShareReferences());
    def.setStreamCoderFactory(codec.config.getStreamCoderFactory());
    def.setVerifier(codec.config.getVerifier());
    try {
        Field serializationInfoRegistryField = FSTConfiguration.class.getDeclaredField("serializationInfoRegistry");
        serializationInfoRegistryField.setAccessible(true);
        FSTClazzInfoRegistry registry = (FSTClazzInfoRegistry) serializationInfoRegistryField.get(codec.config);
        serializationInfoRegistryField.set(def, registry);
    } catch (Exception e) {
        throw new IllegalStateException(e);
    }
    return def;
}
Also used : FSTConfiguration(org.nustaq.serialization.FSTConfiguration) Field(java.lang.reflect.Field) FSTClazzInfoRegistry(org.nustaq.serialization.FSTClazzInfoRegistry) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 Field (java.lang.reflect.Field)1 FSTClazzInfoRegistry (org.nustaq.serialization.FSTClazzInfoRegistry)1 FSTConfiguration (org.nustaq.serialization.FSTConfiguration)1