Java 类org.springframework.core.serializer.support.DeserializingConverter 实例源码

项目:oma-riista-web    文件:HttpSessionConfig.java   
private static GenericConversionService safeConversionService() {
    final GenericConversionService converter = new GenericConversionService();
    converter.addConverter(Object.class, byte[].class, new SerializingConverter());

    final DeserializingConverter byteConverter = new DeserializingConverter();
    converter.addConverter(byte[].class, Object.class, (byte[] bytes) -> {
        try {
            return byteConverter.convert(bytes);
        } catch (SerializationFailedException e) {
            LOG.error("Could not extract attribute: {}", e.getMessage());
            return null;
        }
    });

    return converter;
}
项目:spring4-understanding    文件:SerializationConverterTests.java   
@Test
public void serializeAndDeserializeString() {
    SerializingConverter toBytes = new SerializingConverter();
    byte[] bytes = toBytes.convert("Testing");
    DeserializingConverter fromBytes = new DeserializingConverter();
    assertEquals("Testing", fromBytes.convert(bytes));
}
项目:spring-session    文件:JdbcHttpSessionConfiguration.java   
private GenericConversionService createConversionServiceWithBeanClassLoader() {
    GenericConversionService conversionService = new GenericConversionService();
    conversionService.addConverter(Object.class, byte[].class,
            new SerializingConverter());
    conversionService.addConverter(byte[].class, Object.class,
            new DeserializingConverter(this.classLoader));
    return conversionService;
}
项目:spring-session    文件:JdbcOperationsSessionRepository.java   
private static GenericConversionService createDefaultConversionService() {
    GenericConversionService converter = new GenericConversionService();
    converter.addConverter(Object.class, byte[].class,
            new SerializingConverter());
    converter.addConverter(byte[].class, Object.class,
            new DeserializingConverter());
    return converter;
}
项目:class-guard    文件:SerializationConverterTests.java   
@Test
public void serializeAndDeserializeString() {
    SerializingConverter toBytes = new SerializingConverter();
    byte[] bytes = toBytes.convert("Testing");
    DeserializingConverter fromBytes = new DeserializingConverter();
    assertEquals("Testing", fromBytes.convert(bytes));
}
项目:spring-data-tarantool    文件:JdkTarantoolSerializer.java   
public JdkTarantoolSerializer() {
    this(new SerializingConverter(), new DeserializingConverter());
}
项目:spring-session-data-mongodb    文件:JdkMongoSessionConverter.java   
public JdkMongoSessionConverter(Duration maxInactiveInterval) {
    this(new SerializingConverter(), new DeserializingConverter(), maxInactiveInterval);
}
项目:spring-session-data-mongodb    文件:JdkMongoSessionConverterTest.java   
@Test(expected = IllegalArgumentException.class)
public void constructorNullSerializer() {
    new JdkMongoSessionConverter(null, new DeserializingConverter(), inactiveInterval);
}
项目:spring4-understanding    文件:SerializationConverterTests.java   
@Test(expected = SerializationFailedException.class)
public void deserializationFailure() {
    DeserializingConverter fromBytes = new DeserializingConverter();
    fromBytes.convert("Junk".getBytes());
}
项目:spring-boot-concourse    文件:RestartCompatibleRedisSerializerConfigurer.java   
RestartCompatibleRedisSerializer(ClassLoader classLoader) {
    this.deserializer = new DeserializingConverter(
            new DefaultDeserializer(classLoader));
}
项目:wicket-spring-boot    文件:SpringDevToolsSerializer.java   
public SpringDevToolsSerializer(){
    this.deserializer = new DeserializingConverter(new DefaultDeserializer(Thread.currentThread().getContextClassLoader()));
}
项目:class-guard    文件:SerializationConverterTests.java   
@Test(expected = SerializationFailedException.class)
public void deserializationFailure() {
    DeserializingConverter fromBytes = new DeserializingConverter();
    fromBytes.convert("Junk".getBytes());
}