You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
value = ((TarantoolTuple) source).getObject(fieldName).orElse(null);
returnreadValue(value, propType);
getMap vs getObject
in fact, the difference between these methods is that one of them has a targetClass, while the other does not have this knowledge. And the key converter search call for these two functions looks like this:
We have checkConverterByTargetType, but what does that mean for converting. We filter only those converters that convert the value to Map.class. Such a converter by default is one DefaultMapValueConverter and it is also the only converter in valueConverters that converts exactly those objects whose class is inherited from MapValue.
Those only one converter will be found for class objects inherited from MapValue and we also check this only converter if it is really converted to Map.class. Therefore, this filtering is not needed here and we can use getObject without targetClass.
convertCustomType overlaps in readValue
After calling getMap and after calling getObject we have in HashMap which passed in all cases to convertCustomType.
In case without canGetObject(fieldName, Map.class) condition branch we passed this Map in readValue -> convertIfNeeded -> convertCustomType
cartridge-springdata/src/main/java/org/springframework/data/tarantool/core/convert/MappingTarantoolReadConverter.java
Lines 198 to 231 in a7c438e
We don't need this branch condition:
cartridge-springdata/src/main/java/org/springframework/data/tarantool/core/convert/MappingTarantoolReadConverter.java
Lines 219 to 220 in a7c438e
Now I'll try to explain why:
cartridge-springdata/src/main/java/org/springframework/data/tarantool/core/convert/MappingTarantoolReadConverter.java
Lines 223 to 225 in a7c438e
getMap
vsgetObject
in fact, the difference between these methods is that one of them has a targetClass, while the other does not have this knowledge. And the key converter search call for these two functions looks like this:
For
getMap
:And for
getObject
:We have
checkConverterByTargetType
, but what does that mean for converting. We filter only those converters that convert the value toMap.class
. Such a converter by default is oneDefaultMapValueConverter
and it is also the only converter invalueConverters
that converts exactly those objects whose class is inherited fromMapValue
.Those only one converter will be found for class objects inherited from
MapValue
and we also check this only converter if it is really converted to Map.class. Therefore, this filtering is not needed here and we can usegetObject
withouttargetClass
.convertCustomType
overlaps inreadValue
After calling
getMap
and after callinggetObject
we have inHashMap
which passed in all cases toconvertCustomType
.In case without
canGetObject(fieldName, Map.class)
condition branch we passed this Map inreadValue
->convertIfNeeded
->convertCustomType
cartridge-springdata/src/main/java/org/springframework/data/tarantool/core/convert/MappingTarantoolReadConverter.java
Lines 233 to 250 in a7c438e
cartridge-springdata/src/main/java/org/springframework/data/tarantool/core/convert/MappingTarantoolReadConverter.java
Lines 327 to 336 in a7c438e
Please advise me if I made a mistake somewhere and it is impossible to remove it.
The text was updated successfully, but these errors were encountered: