Skip to content

Commit 855c9d4

Browse files
committed
DATAMONGO-1269 - Polishing.
Original pull request: #314.
1 parent e0b8f5b commit 855c9d4

File tree

1 file changed

+9
-7
lines changed
  • spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert

1 file changed

+9
-7
lines changed

spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/convert/QueryMapper.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -879,10 +879,14 @@ static class PositionParameterRetainingPropertyKeyConverter implements Converter
879879

880880
private final KeyMapper keyMapper;
881881

882-
PositionParameterRetainingPropertyKeyConverter(String rawKey) {
882+
public PositionParameterRetainingPropertyKeyConverter(String rawKey) {
883883
this.keyMapper = new KeyMapper(rawKey);
884884
}
885885

886+
/*
887+
* (non-Javadoc)
888+
* @see org.springframework.core.convert.converter.Converter#convert(java.lang.Object)
889+
*/
886890
@Override
887891
public String convert(MongoPersistentProperty source) {
888892
return keyMapper.mapPropertyName(source);
@@ -916,7 +920,7 @@ public TypeInformation<?> getTypeHint() {
916920
*/
917921
static class KeyMapper {
918922

919-
Iterator<String> iterator;
923+
private final Iterator<String> iterator;
920924

921925
public KeyMapper(String key) {
922926

@@ -933,14 +937,13 @@ public KeyMapper(String key) {
933937
protected String mapPropertyName(MongoPersistentProperty property) {
934938

935939
String mappedName = PropertyToFieldNameConverter.INSTANCE.convert(property);
936-
937940
boolean inspect = iterator.hasNext();
941+
938942
while (inspect) {
939943

940944
String partial = iterator.next();
945+
boolean isPositional = (isPositionalParameter(partial) && (property.isMap() || property.isCollectionLike()));
941946

942-
boolean isPositional = (isPositionalParameter(partial) && (property.isMap() || property.isCollectionLike() || property
943-
.isArray()));
944947
if (isPositional) {
945948
mappedName += "." + partial;
946949
}
@@ -951,7 +954,7 @@ protected String mapPropertyName(MongoPersistentProperty property) {
951954
return mappedName;
952955
}
953956

954-
boolean isPositionalParameter(String partial) {
957+
private static boolean isPositionalParameter(String partial) {
955958

956959
if (partial.equals("$")) {
957960
return true;
@@ -965,7 +968,6 @@ boolean isPositionalParameter(String partial) {
965968
}
966969
}
967970
}
968-
969971
}
970972

971973
/**

0 commit comments

Comments
 (0)