Package org.kiwiproject.spring.data
Class KiwiMongoConverters
- java.lang.Object
-
- org.kiwiproject.spring.data.KiwiMongoConverters
-
public class KiwiMongoConverters extends Object
A few utilities related to Spring Data Mongo and customConverters.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classKiwiMongoConverters.BsonUndefinedToNullStringConverterAConverterthat maps from the JS 'undefined' type to a 'null' value.
-
Constructor Summary
Constructors Constructor Description KiwiMongoConverters()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static org.springframework.data.mongodb.core.MongoTemplateaddCustomConverters(org.springframework.data.mongodb.core.MongoTemplate template, org.springframework.core.convert.converter.Converter<?,?>... converters)Adds one or more custom converters to aMongoTemplateinstance.static org.springframework.core.convert.converter.Converter<org.bson.BsonUndefined,String>newBsonUndefinedToNullObjectConverter()Create a newKiwiMongoConverters.BsonUndefinedToNullStringConverter.
-
-
-
Method Detail
-
newBsonUndefinedToNullObjectConverter
public static org.springframework.core.convert.converter.Converter<org.bson.BsonUndefined,String> newBsonUndefinedToNullObjectConverter()
Create a newKiwiMongoConverters.BsonUndefinedToNullStringConverter.- Returns:
- new BsonUndefinedToNullStringConverter instance
-
addCustomConverters
public static org.springframework.data.mongodb.core.MongoTemplate addCustomConverters(org.springframework.data.mongodb.core.MongoTemplate template, org.springframework.core.convert.converter.Converter<?,?>... converters)Adds one or more custom converters to aMongoTemplateinstance.The MongoTemplate is assumed to have a
Converterof typeMappingMongoConverter.- Parameters:
template- the MongoTemplateconverters- the converters to add to MongoTemplate's existing converter- Returns:
- the template instance, for method chaining
- Throws:
IllegalArgumentException- if the given MongoTemplate'sConverteris not aMappingMongoConverter- See Also:
AbstractMongoConverter.setCustomConversions(CustomConversions)
-
-