Example usage for org.springframework.data.redis.serializer SerializationUtils EMPTY_ARRAY

List of usage examples for org.springframework.data.redis.serializer SerializationUtils EMPTY_ARRAY

Introduction

In this page you can find the example usage for org.springframework.data.redis.serializer SerializationUtils EMPTY_ARRAY.

Prototype

null EMPTY_ARRAY

To view the source code for org.springframework.data.redis.serializer SerializationUtils EMPTY_ARRAY.

Click Source Link

Usage

From source file:org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer.java

public byte[] serialize(Object t) throws SerializationException {

    if (t == null) {
        return SerializationUtils.EMPTY_ARRAY;
    }/* w w w  .  j a  v  a2  s.c o m*/
    try {
        return this.objectMapper.writeValueAsBytes(t);
    } catch (Exception ex) {
        throw new SerializationException("Could not write JSON: " + ex.getMessage(), ex);
    }
}

From source file:org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer.java

@Override
public byte[] serialize(Object source) throws SerializationException {

    if (source == null) {
        return SerializationUtils.EMPTY_ARRAY;
    }/*from  w  w  w  .  j  a  va  2 s.  c  o m*/

    try {
        return mapper.writeValueAsBytes(source);
    } catch (final JsonProcessingException e) {
        throw new SerializationException("Could not write JSON: " + e.getMessage(), e);
    }
}