|
75 | 75 | import org.springframework.util.ClassUtils; |
76 | 76 | import org.springframework.util.CollectionUtils; |
77 | 77 | import org.springframework.util.ObjectUtils; |
| 78 | +import org.springframework.util.StringUtils; |
78 | 79 |
|
79 | 80 | import com.mongodb.BasicDBList; |
80 | 81 | import com.mongodb.BasicDBObject; |
@@ -182,6 +183,9 @@ public MongoTypeMapper getTypeMapper() { |
182 | 183 | * any translation but rather reject a {@link Map} with keys containing dots causing the conversion for the entire |
183 | 184 | * object to fail. If further customization of the translation is needed, have a look at |
184 | 185 | * {@link #potentiallyEscapeMapKey(String)} as well as {@link #potentiallyUnescapeMapKey(String)}. |
| 186 | + * <p> |
| 187 | + * {@code mapKeyDotReplacement} is used as-is during replacement operations without further processing (i.e. regex or |
| 188 | + * normalization). |
185 | 189 | * |
186 | 190 | * @param mapKeyDotReplacement the mapKeyDotReplacement to set. Can be {@literal null}. |
187 | 191 | */ |
@@ -900,7 +904,7 @@ protected String potentiallyEscapeMapKey(String source) { |
900 | 904 | source)); |
901 | 905 | } |
902 | 906 |
|
903 | | - return source.replaceAll("\\.", mapKeyDotReplacement); |
| 907 | + return StringUtils.replace(source, ".", mapKeyDotReplacement); |
904 | 908 | } |
905 | 909 |
|
906 | 910 | /** |
@@ -928,7 +932,7 @@ private String potentiallyConvertMapKey(Object key) { |
928 | 932 | * @return |
929 | 933 | */ |
930 | 934 | protected String potentiallyUnescapeMapKey(String source) { |
931 | | - return mapKeyDotReplacement == null ? source : source.replaceAll(mapKeyDotReplacement, "\\."); |
| 935 | + return mapKeyDotReplacement == null ? source : StringUtils.replace(source, mapKeyDotReplacement, "."); |
932 | 936 | } |
933 | 937 |
|
934 | 938 | /** |
|
0 commit comments