Polishing.

Add missing Nullable annotations to serializers.

See #3053
Original pull request: #3058
This commit is contained in:
Mark Paluch
2025-01-15 14:10:09 +01:00
parent 6f399ab6de
commit ce2c7caee7
6 changed files with 8 additions and 4 deletions

View File

@@ -277,6 +277,7 @@ public class GenericJackson2JsonRedisSerializer implements RedisSerializer<Objec
}
@Override
@Nullable
public Object deserialize(@Nullable byte[] source) throws SerializationException {
return deserialize(source, Object.class);
}
@@ -375,10 +376,6 @@ public class GenericJackson2JsonRedisSerializer implements RedisSerializer<Objec
/**
* Lenient variant of ObjectMapper._readTreeAndClose using a strict {@link JsonNodeDeserializer}.
*
* @param source
* @return
* @throws IOException
*/
private JsonNode readTree(byte[] source) throws IOException {

View File

@@ -92,6 +92,7 @@ public class GenericToStringSerializer<T> implements RedisSerializer<T>, BeanFac
}
@Override
@Nullable
public T deserialize(@Nullable byte[] bytes) {
if (bytes == null) {

View File

@@ -158,6 +158,7 @@ public class Jackson2JsonRedisSerializer<T> implements RedisSerializer<T> {
}
}
@Nullable
@Override
@SuppressWarnings("unchecked")
public T deserialize(@Nullable byte[] bytes) throws SerializationException {

View File

@@ -84,6 +84,7 @@ public class JdkSerializationRedisSerializer implements RedisSerializer<Object>
this.deserializer = deserializer;
}
@Nullable
@Override
public byte[] serialize(@Nullable Object value) {
@@ -98,6 +99,7 @@ public class JdkSerializationRedisSerializer implements RedisSerializer<Object>
}
}
@Nullable
@Override
public Object deserialize(@Nullable byte[] bytes) {

View File

@@ -102,6 +102,7 @@ public class OxmSerializer implements InitializingBean, RedisSerializer<Object>
return stream.toByteArray();
}
@Nullable
@Override
public Object deserialize(@Nullable byte[] bytes) throws SerializationException {

View File

@@ -80,11 +80,13 @@ public class StringRedisSerializer implements RedisSerializer<String> {
this.charset = charset;
}
@Nullable
@Override
public byte[] serialize(@Nullable String value) {
return (value == null ? null : value.getBytes(charset));
}
@Nullable
@Override
public String deserialize(@Nullable byte[] bytes) {
return (bytes == null ? null : new String(bytes, charset));