/** * Add a default sort derived from {@link org.springframework.data.mongodb.repository.Query#sort()} to the given * {@link Query} if present. * * @param query the {@link Query} to potentially apply the sort to. * @return the query with potential default sort applied. * @since 2.1 */ Query applyAnnotatedDefaultSortIfPresent(Query query) { if (!method.hasAnnotatedSort()) { return query; } return QueryUtils.decorateSort(query, Document.parse(method.getAnnotatedSort())); }
/** * Add a default sort derived from {@link org.springframework.data.mongodb.repository.Query#sort()} to the given * {@link Query} if present. * * @param query the {@link Query} to potentially apply the sort to. * @return the query with potential default sort applied. * @since 2.1 */ Query applyAnnotatedDefaultSortIfPresent(Query query) { if (!method.hasAnnotatedSort()) { return query; } return QueryUtils.decorateSort(query, Document.parse(method.getAnnotatedSort())); }