31
31
import java .util .regex .Pattern ;
32
32
33
33
import org .jspecify .annotations .Nullable ;
34
-
35
34
import org .springframework .beans .factory .InitializingBean ;
36
35
import org .springframework .core .CollectionFactory ;
37
36
import org .springframework .core .convert .ConversionService ;
@@ -173,7 +172,7 @@ public MappingRedisConverter(@Nullable RedisMappingContext mappingContext, @Null
173
172
}
174
173
175
174
@ Override
176
- @ SuppressWarnings ({"unchecked" , "NullAway" })
175
+ @ SuppressWarnings ({ "unchecked" , "NullAway" })
177
176
public <R > R read (Class <R > type , RedisData source ) {
178
177
179
178
TypeInformation <?> readType = typeMapper .readType (source .getBucket ().getPath (), TypeInformation .of (type ));
@@ -188,8 +187,8 @@ public <R> R read(Class<R> type, RedisData source) {
188
187
return source .getBucket ().isEmpty () ? null : doReadInternal (path , type , source );
189
188
}
190
189
191
- @ SuppressWarnings ({"unchecked" , "NullAway" })
192
- private <R > R doReadInternal (String path , Class <R > type , RedisData source ) {
190
+ @ SuppressWarnings ({ "unchecked" , "NullAway" })
191
+ private <R > R doReadInternal (String path , Class <R > type , RedisData source ) {
193
192
194
193
TypeInformation <?> readType = typeMapper .readType (source .getBucket ().getPath (), TypeInformation .of (type ));
195
194
@@ -403,14 +402,8 @@ public void write(@Nullable Object source, RedisData sink) {
403
402
return ;
404
403
}
405
404
406
- if (source instanceof Collection ) {
407
- writeCollection (
408
- sink .getKeyspace (),
409
- "" ,
410
- (List <?>) source ,
411
- TypeInformation .of (Object .class ),
412
- sink
413
- );
405
+ if (source instanceof Collection collection ) {
406
+ writeCollection (sink .getKeyspace (), "" , collection , TypeInformation .of (Object .class ), sink );
414
407
return ;
415
408
}
416
409
@@ -432,8 +425,7 @@ public void write(@Nullable Object source, RedisData sink) {
432
425
sink .setKeyspace (keySpace );
433
426
434
427
if (entity .getTypeInformation ().isCollectionLike ()) {
435
- writeCollection (keySpace , "" , (List ) source , entity .getTypeInformation ().getRequiredComponentType (),
436
- sink );
428
+ writeCollection (keySpace , "" , (List ) source , entity .getTypeInformation ().getRequiredComponentType (), sink );
437
429
} else {
438
430
writeInternal (keySpace , "" , source , entity .getTypeInformation (), sink );
439
431
}
@@ -562,8 +554,7 @@ private void writePartialPropertyUpdate(PartialUpdate<?> update, PropertyUpdate
562
554
writeMap (keySpace , pUpdate .getPropertyPath (), targetProperty .getMapValueType (), map , sink );
563
555
} else {
564
556
565
- writeInternal (keySpace , pUpdate .getPropertyPath (), pUpdate .getValue (),
566
- targetProperty .getTypeInformation (), sink );
557
+ writeInternal (keySpace , pUpdate .getPropertyPath (), pUpdate .getValue (), targetProperty .getTypeInformation (), sink );
567
558
568
559
Set <IndexedData > data = indexResolver .resolveIndexesFor (keySpace , pUpdate .getPropertyPath (),
569
560
targetProperty .getTypeInformation (), pUpdate .getValue ());
@@ -586,8 +577,7 @@ RedisPersistentProperty getTargetPropertyOrNullForPath(String path, Class<?> typ
586
577
PersistentPropertyPath <RedisPersistentProperty > persistentPropertyPath = mappingContext
587
578
.getPersistentPropertyPath (path , type );
588
579
return persistentPropertyPath .getLeafProperty ();
589
- } catch (Exception ignore ) {
590
- }
580
+ } catch (Exception ignore ) {}
591
581
592
582
return null ;
593
583
}
@@ -694,7 +684,7 @@ private ReferenceResolver getRequiredReferenceResolver() {
694
684
695
685
Assert .notNull (referenceResolver , "ReferenceResolver must not be null" );
696
686
return referenceResolver ;
697
- }
687
+ }
698
688
699
689
private void writeAssociation (String path , RedisPersistentEntity <?> entity , @ Nullable Object value , RedisData sink ) {
700
690
@@ -822,7 +812,8 @@ private void writeToBucket(String path, @Nullable Object value, RedisData sink,
822
812
}
823
813
824
814
@ SuppressWarnings ("NullAway" )
825
- private @ Nullable Object readCollectionOrArray (String path , Class <?> collectionType , Class <?> valueType , Bucket bucket ) {
815
+ private @ Nullable Object readCollectionOrArray (String path , Class <?> collectionType , Class <?> valueType ,
816
+ Bucket bucket ) {
826
817
827
818
List <String > keys = new ArrayList <>(bucket .extractAllKeysFor (path ));
828
819
keys .sort (listKeyComparator );
@@ -991,7 +982,7 @@ private Class<?> getTypeHint(String path, Bucket bucket, Class<?> fallback) {
991
982
* @return
992
983
* @throws ConverterNotFoundException
993
984
*/
994
- public byte @ Nullable [] toBytes (Object source ) {
985
+ public byte @ Nullable [] toBytes (Object source ) {
995
986
996
987
if (source instanceof byte [] bytes ) {
997
988
return bytes ;
0 commit comments