@ -23,13 +23,14 @@ import org.bson.codecs.configuration.CodecRegistry;
@@ -23,13 +23,14 @@ import org.bson.codecs.configuration.CodecRegistry;
import org.springframework.data.mongodb.util.json.ParameterBindingDocumentCodec ;
import org.springframework.data.util.Lazy ;
import org.springframework.lang.Nullable ;
import org.springframework.util.Assert ;
import org.springframework.util.ObjectUtils ;
import org.springframework.util.StringUtils ;
/ * *
* A { @link MongoExpression } using the { @link ParameterBindingDocumentCodec } for parsing a raw ( { @literal json } )
* expression . The expression will be wrapped within < code > { . . . } < / code > if necessary . The actual parsing and parameter
* binding of placeholders like { @code ? 0 } is delayed upon first call on the the t arget { @link Document } via
* binding of placeholders like { @code ? 0 } is delayed upon first call on the target { @link Document } via
* { @link # toDocument ( ) } .
* < br / >
*
@ -45,6 +46,7 @@ import org.springframework.util.StringUtils;
@@ -45,6 +46,7 @@ import org.springframework.util.StringUtils;
* containing the required { @link org . bson . codecs . Codec codec } via { @link # withCodecRegistry ( CodecRegistry ) } .
*
* @author Christoph Strobl
* @author Giacomo Baso
* @since 3 . 2
* /
public class BindableMongoExpression implements MongoExpression {
@ -77,7 +79,9 @@ public class BindableMongoExpression implements MongoExpression {
@@ -77,7 +79,9 @@ public class BindableMongoExpression implements MongoExpression {
public BindableMongoExpression ( String expression , @Nullable CodecRegistryProvider codecRegistryProvider ,
@Nullable Object [ ] args ) {
this . expressionString = expression ;
Assert . notNull ( expression , "Expression must not be null" ) ;
this . expressionString = expression . trim ( ) ;
this . codecRegistryProvider = codecRegistryProvider ;
this . args = args ;
this . target = Lazy . of ( this : : parse ) ;