@@ -271,7 +271,7 @@ public Object get(Object id, String keyspace) {
271271 @ Override
272272 public <T > T get (Object id , String keyspace , Class <T > type ) {
273273
274- String stringId = asString (id );
274+ String stringId = toString (id );
275275 byte [] binId = createKey (keyspace , stringId );
276276
277277 RedisCallback <Map <byte [], byte []>> command = connection -> connection .hGetAll (binId );
@@ -305,7 +305,7 @@ public <T> T delete(Object id, String keyspace, Class<T> type) {
305305
306306 if (value != null ) {
307307
308- byte [] keyToDelete = createKey (keyspace , asString (id ));
308+ byte [] keyToDelete = createKey (keyspace , toString (id ));
309309
310310 redisOps .execute ((RedisCallback <Void >) connection -> {
311311
@@ -383,6 +383,7 @@ public void deleteAllOf(String keyspace) {
383383
384384 connection .del (toBytes (keyspace ));
385385 new IndexWriter (connection , converter ).removeAllIndexes (keyspace );
386+
386387 return null ;
387388 });
388389 }
@@ -503,7 +504,7 @@ private RedisUpdateObject fetchDeletePathsFromHashAndUpdateIndex(RedisUpdateObje
503504
504505 for (byte [] field : existingFields ) {
505506
506- if (asString (field ).startsWith (path + "." )) {
507+ if (toString (field ).startsWith (path + "." )) {
507508
508509 redisUpdateObject .addFieldToRemove (field );
509510 value = connection .hGet (redisUpdateObject .targetKey , toBytes (field ));
@@ -555,11 +556,13 @@ public void clear() {
555556 // nothing to do
556557 }
557558
558- private String asString (Object value ) {
559- return value instanceof String stringValue ? stringValue
560- : getConverter ().getConversionService ().convert (value , String .class );
561- }
562-
559+ /**
560+ * Creates a new {@link byte[] key} using the given {@link String keyspace} and {@link String id}.
561+ *
562+ * @param keyspace {@link String name} of the Redis {@literal keyspace}.
563+ * @param id {@link String} identifying the key.
564+ * @return a {@link byte[]} constructed from the {@link String keyspace} and {@link String id}.
565+ */
563566 public byte [] createKey (String keyspace , String id ) {
564567 return toBytes (keyspace + ":" + id );
565568 }
@@ -568,12 +571,13 @@ public byte[] createKey(String keyspace, String id) {
568571 * Convert given source to binary representation using the underlying {@link ConversionService}.
569572 */
570573 public byte [] toBytes (Object source ) {
574+ return source instanceof byte [] bytes ? bytes
575+ : getConverter ().getConversionService ().convert (source , byte [].class );
576+ }
571577
572- if (source instanceof byte [] bytes ) {
573- return bytes ;
574- }
575-
576- return converter .getConversionService ().convert (source , byte [].class );
578+ private String toString (Object value ) {
579+ return value instanceof String stringValue ? stringValue
580+ : getConverter ().getConversionService ().convert (value , String .class );
577581 }
578582
579583 /**
@@ -734,6 +738,7 @@ private void initKeyExpirationListener() {
734738
735739 MappingExpirationListener listener = new MappingExpirationListener (this .messageListenerContainer , this .redisOps ,
736740 this .converter );
741+
737742 listener .setKeyspaceNotificationsConfigParameter (keyspaceNotificationsConfigParameter );
738743
739744 if (this .eventPublisher != null ) {
0 commit comments