@ -238,14 +238,14 @@ class QueryBlocks {
@@ -238,14 +238,14 @@ class QueryBlocks {
if ( StringUtils . hasText ( source . getQuery ( ) . getFieldsString ( ) ) ) {
VariableSnippet fields = Snippet . declare ( builder ) . variable ( Document . class , context . localVariable ( "fields" ) )
. of ( MongoCodeBlocks . asDocument ( source . getQuery ( ) . getFieldsString ( ) , queryParameters . get ( ) ) ) ;
. of ( MongoCodeBlocks . asDocument ( context . getExpressionMarker ( ) , source . getQuery ( ) . getFieldsString ( ) , queryParameters . get ( ) ) ) ;
builder . addStatement ( "$L.setFieldsObject($L)" , queryVariableName , fields . getVariableName ( ) ) ;
}
if ( StringUtils . hasText ( source . getQuery ( ) . getSortString ( ) ) ) {
VariableSnippet sort = Snippet . declare ( builder ) . variable ( Document . class , context . localVariable ( "sort" ) )
. of ( MongoCodeBlocks . asDocument ( source . getQuery ( ) . getSortString ( ) , getQueryParameters ( ) ) ) ;
. of ( MongoCodeBlocks . asDocument ( context . getExpressionMarker ( ) , source . getQuery ( ) . getSortString ( ) , getQueryParameters ( ) ) ) ;
builder . addStatement ( "$L.setSortObject($L)" , queryVariableName , sort . getVariableName ( ) ) ;
}
@ -306,12 +306,12 @@ class QueryBlocks {
@@ -306,12 +306,12 @@ class QueryBlocks {
if ( getQueryParameters ( ) . isEmpty ( ) ) {
builder . addStatement (
"$L.collation(collationOf(evaluate(ExpressionMarker.class.getEnclosingMethod() , $S)))" ,
queryVariableName , collationString ) ;
"$L.collation(collationOf(evaluate($L , $S)))" ,
queryVariableName , context . getExpressionMarker ( ) . enclosingMethod ( ) , co llationString ) ;
} else {
builder . addStatement (
"$L.collation(collationOf(evaluate(ExpressionMarker.class.getEnclosingMethod() , $S, $L)))" ,
queryVariableName , collationString , getQueryParameters ( ) ) ;
"$L.collation(collationOf(evaluate($L , $S, $L)))" ,
queryVariableName , context . getExpressionMarker ( ) . enclosingMethod ( ) , co llationString , getQueryParameters ( ) ) ;
}
}
}
@ -337,9 +337,9 @@ class QueryBlocks {
@@ -337,9 +337,9 @@ class QueryBlocks {
} else if ( MongoCodeBlocks . containsPlaceholder ( source ) ) {
Builder builder = CodeBlock . builder ( ) ;
if ( getQueryParameters ( ) . isEmpty ( ) ) {
builder . add ( "createQuery(ExpressionMarker.class.getEnclosingMethod(), $S)" , source ) ;
builder . add ( "createQuery($L, $S)" , context . getExpressionMarker ( ) . enclosingMethod ( ) , source ) ;
} else {
builder . add ( "createQuery(ExpressionMarker.class.getEnclosingMethod(), $S, $L)" , source , getQueryParameters ( ) ) ;
builder . add ( "createQuery($L, $S, $L)" , context . getExpressionMarker ( ) . enclosingMethod ( ) , source , getQueryParameters ( ) ) ;
}
return builder . build ( ) ;
} else {