diff --git a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/QueryMapper.java b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/QueryMapper.java index 8bbd87bad..a5b6347cf 100644 --- a/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/QueryMapper.java +++ b/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/QueryMapper.java @@ -879,10 +879,14 @@ public class QueryMapper { private final KeyMapper keyMapper; - PositionParameterRetainingPropertyKeyConverter(String rawKey) { + public PositionParameterRetainingPropertyKeyConverter(String rawKey) { this.keyMapper = new KeyMapper(rawKey); } + /* + * (non-Javadoc) + * @see org.springframework.core.convert.converter.Converter#convert(java.lang.Object) + */ @Override public String convert(MongoPersistentProperty source) { return keyMapper.mapPropertyName(source); @@ -916,7 +920,7 @@ public class QueryMapper { */ static class KeyMapper { - Iterator iterator; + private final Iterator iterator; public KeyMapper(String key) { @@ -933,14 +937,13 @@ public class QueryMapper { protected String mapPropertyName(MongoPersistentProperty property) { String mappedName = PropertyToFieldNameConverter.INSTANCE.convert(property); - boolean inspect = iterator.hasNext(); + while (inspect) { String partial = iterator.next(); + boolean isPositional = (isPositionalParameter(partial) && (property.isMap() || property.isCollectionLike())); - boolean isPositional = (isPositionalParameter(partial) && (property.isMap() || property.isCollectionLike() || property - .isArray())); if (isPositional) { mappedName += "." + partial; } @@ -951,7 +954,7 @@ public class QueryMapper { return mappedName; } - boolean isPositionalParameter(String partial) { + private static boolean isPositionalParameter(String partial) { if (partial.equals("$")) { return true; @@ -965,7 +968,6 @@ public class QueryMapper { } } } - } /**