Spring Framework SerializingConverter - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework SerializingConverter class.

This code example shows how to use the following methods:convert
		} 
	} 
 
	@Test
	public void nonSerializableField() { 
		SerializingConverter toBytes = new SerializingConverter();
		try { 
			toBytes.convert(new UnSerializable());
			fail("Expected SerializationFailureException"); 
		} 
		catch (SerializationFailedException e) {
			assertNotNull(e.getCause());
			assertTrue(e.getCause() instanceof NotSerializableException);
		} 
	} 
 
	@Test(expected = SerializationFailedException.class)
	public void deserializationFailure() { 
		DeserializingConverter fromBytes = new DeserializingConverter();
		fromBytes.convert("Junk".getBytes());
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 * @since 1.0.1 
 */ 
public class PayloadSerializingTransformer extends PayloadTypeConvertingTransformer<Object, byte[]> { 
 
	public void setSerializer(Serializer<Object> serializer) { 
		this.setConverter(new SerializingConverter(serializer)); 
	} 
 
	@Override 
	protected byte[] transformPayload(Object payload) throws Exception { 
		if (this.converter == null) { 
			this.setConverter(new SerializingConverter()); 
		} 
		return this.converter.convert(payload); 
	} 
 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
 * @author Mark Pollack 
 * @author Costin Leau 
 */ 
public class JdkSerializationRedisSerializer implements RedisSerializer<Object> {
 
	private Converter<Object, byte[]> serializer = new SerializingConverter();
	private Converter<byte[], Object> deserializer = new DeserializingConverter();
 
	public Object deserialize(byte[] bytes) {
		if (SerializationUtils.isEmpty(bytes)) {
			return null; 
		} 
 
		try { 
			return deserializer.convert(bytes);
		} catch (Exception ex) {
			throw new SerializationException("Cannot deserialize", ex);
		} 
	} 
 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:convert
    public void destory() { 
        jedisPool.returnResource(jedis);
    } 
 
    private byte[] serializeObject(Object obj) {
        SerializingConverter sc = new SerializingConverter();
        return sc.convert(obj);
    } 
 
    private Object deserializeObject(byte[] b) {
        DeserializingConverter dc = new DeserializingConverter();
        return dc.convert(b);
    } 
 
    public boolean lock(Object key, Integer expireMsecs) throws InterruptedException {
 
        String lockKey = generateLockKey(key);
        long expires = System.currentTimeMillis() + expireMsecs + 1;
        String expiresStr = String.valueOf(expires);
        long timeout = expireMsecs;
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:
	/** 
	 * Convenient constructor for configuration use. 
	 */ 
	public JdbcChannelMessageStore() { 
		deserializer = new DeserializingConverter(); 
		serializer = new SerializingConverter(); 
	} 
 
	/** 
	 * Create a {@link MessageStore} with all mandatory properties. The passed-in 
	 * {@link DataSource} is used to instantiate a {@link JdbcTemplate} 
	 * 
	 * with {@link JdbcTemplate#setFetchSize(int)} set to <code>1</code> 
	 * and with {@link JdbcTemplate#setMaxRows(int)} set to <code>1</code>. 
	 * 
	 * @param dataSource a {@link DataSource} 
	 */ 
	public JdbcChannelMessageStore(DataSource dataSource) { 
		this(); 
		jdbcTemplate = new JdbcTemplate(dataSource); 
3
CodeRank
Experience pair programming with AI  Get Codota for Java
See Code Examples for Spring Framework SerializingConverter Methods: