Skip to content

Commit

Permalink
Polishing.
Browse files Browse the repository at this point in the history
Add missing Nullable annotations to serializers.

See #3053
Original pull request: #3058
  • Loading branch information
mp911de committed Jan 15, 2025
1 parent 525f9b6 commit 020e5b6
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ public byte[] serialize(@Nullable Object value) throws SerializationException {
}

@Override
@Nullable
public Object deserialize(@Nullable byte[] source) throws SerializationException {
return deserialize(source, Object.class);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public byte[] serialize(@Nullable T value) {
}

@Override
@Nullable
public T deserialize(@Nullable byte[] bytes) {

if (bytes == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ public byte[] serialize(@Nullable T value) throws SerializationException {
}
}

@Nullable
@Override
@SuppressWarnings("unchecked")
public T deserialize(@Nullable byte[] bytes) throws SerializationException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public JdkSerializationRedisSerializer(Converter<Object, byte[]> serializer,
this.deserializer = deserializer;
}

@Nullable
@Override
public byte[] serialize(@Nullable Object value) {

Expand All @@ -98,6 +99,7 @@ public byte[] serialize(@Nullable Object value) {
}
}

@Nullable
@Override
public Object deserialize(@Nullable byte[] bytes) {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public byte[] serialize(@Nullable Object value) throws SerializationException {
return stream.toByteArray();
}

@Nullable
@Override
public Object deserialize(@Nullable byte[] bytes) throws SerializationException {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,13 @@ public StringRedisSerializer(Charset charset) {
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));
Expand Down

0 comments on commit 020e5b6

Please sign in to comment.