Package org.springframework.data.mongodb
Class BindableMongoExpression
java.lang.Object
org.springframework.data.mongodb.BindableMongoExpression
- All Implemented Interfaces:
MongoExpression
A
MongoExpression using the ParameterBindingDocumentCodec for parsing a raw (json)
expression. The expression will be wrapped within { ... } if necessary. The actual parsing and parameter
binding of placeholders like ?0 is delayed upon first call on the target Document via
toDocument().
$toUpper : $name -> { '$toUpper' : '$name' }
{ '$toUpper' : '$name' } -> { '$toUpper' : '$name' }
{ '$toUpper' : '?0' }, "$name" -> { '$toUpper' : '$name' }
Some types might require a special Codec. If so, make sure to provide a CodecRegistry
containing the required codec via withCodecRegistry(CodecRegistry).- Since:
- 3.2
- Author:
- Christoph Strobl, Giacomo Baso
-
Constructor Summary
ConstructorsConstructorDescriptionBindableMongoExpression(String expression, Object[] args) Create a new instance ofBindableMongoExpression.BindableMongoExpression(String expression, CodecRegistryProvider codecRegistryProvider, Object[] args) Create a new instance ofBindableMongoExpression. -
Method Summary
Modifier and TypeMethodDescriptionProvide the arguments to bind to the placeholders via their index.org.bson.DocumentObtain the nativeDocumentrepresentation.toString()withCodecRegistry(org.bson.codecs.configuration.CodecRegistry codecRegistry) Provide theCodecRegistryused to convert expressions.
-
Constructor Details
-
BindableMongoExpression
Create a new instance ofBindableMongoExpression.- Parameters:
expression- must not be null.args- can be null.
-
BindableMongoExpression
public BindableMongoExpression(String expression, @Nullable CodecRegistryProvider codecRegistryProvider, @Nullable Object[] args) Create a new instance ofBindableMongoExpression.- Parameters:
expression- must not be null.codecRegistryProvider- can be null.args- can be null.
-
-
Method Details
-
withCodecRegistry
public BindableMongoExpression withCodecRegistry(org.bson.codecs.configuration.CodecRegistry codecRegistry) Provide theCodecRegistryused to convert expressions.- Parameters:
codecRegistry- must not be null.- Returns:
- new instance of
BindableMongoExpression.
-
bind
Provide the arguments to bind to the placeholders via their index.- Parameters:
args- must not be null.- Returns:
- new instance of
BindableMongoExpression.
-
toDocument
public org.bson.Document toDocument()Description copied from interface:MongoExpressionObtain the nativeDocumentrepresentation.- Specified by:
toDocumentin interfaceMongoExpression- Returns:
- never null.
-
toString
-