/** * Maps the property name while retaining potential positional operator {@literal $}. * * @param property * @return */ protected String mapPropertyName(MongoPersistentProperty property) { StringBuilder mappedName = new StringBuilder(PropertyToFieldNameConverter.INSTANCE.convert(property)); boolean inspect = iterator.hasNext(); while (inspect) { String partial = iterator.next(); boolean isPositional = (isPositionalParameter(partial) && (property.isMap() || property.isCollectionLike())); if (isPositional) { mappedName.append(".").append(partial); } inspect = isPositional && iterator.hasNext(); } return mappedName.toString(); }
/** * If the target property of the comparison is of type String, then the operator checks for match using regular * expression. If the target property of the comparison is a {@link Collection} then the operator evaluates to true if * it finds an exact match within any member of the {@link Collection}. * * @param part * @param property * @param criteria * @param parameters * @return */ private Criteria createContainingCriteria(Part part, MongoPersistentProperty property, Criteria criteria, Iterator<Object> parameters) { if (property.isCollectionLike()) { return criteria.in(nextAsArray(parameters)); } return addAppropriateLikeRegexTo(criteria, part, parameters.next()); }
/** * Maps the property name while retaining potential positional operator {@literal $}. * * @param property * @return */ protected String mapPropertyName(MongoPersistentProperty property) { StringBuilder mappedName = new StringBuilder(PropertyToFieldNameConverter.INSTANCE.convert(property)); boolean inspect = iterator.hasNext(); while (inspect) { String partial = iterator.next(); boolean isPositional = (isPositionalParameter(partial) && (property.isMap() || property.isCollectionLike())); if (isPositional) { mappedName.append(".").append(partial); } inspect = isPositional && iterator.hasNext(); } return mappedName.toString(); }
/** * If the target property of the comparison is of type String, then the operator checks for match using regular * expression. If the target property of the comparison is a {@link Collection} then the operator evaluates to true if * it finds an exact match within any member of the {@link Collection}. * * @param part * @param property * @param criteria * @param parameters * @return */ private Criteria createContainingCriteria(Part part, MongoPersistentProperty property, Criteria criteria, Iterator<Object> parameters) { if (property.isCollectionLike()) { return criteria.in(nextAsArray(parameters)); } return addAppropriateLikeRegexTo(criteria, part, parameters.next()); }