Class AbstractMongoConverter

java.lang.Object
org.springframework.data.mongodb.core.convert.AbstractMongoConverter
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, org.springframework.data.convert.EntityConverter<MongoPersistentEntity<?>,MongoPersistentProperty,Object,org.bson.conversions.Bson>, org.springframework.data.convert.EntityReader<Object,org.bson.conversions.Bson>, org.springframework.data.convert.EntityWriter<Object,org.bson.conversions.Bson>, CodecRegistryProvider, MongoConverter, MongoWriter<Object>
Direct Known Subclasses:
MappingMongoConverter

public abstract class AbstractMongoConverter extends Object implements MongoConverter, org.springframework.beans.factory.InitializingBean
Base class for MongoConverter implementations. Sets up a GenericConversionService and populates basic converters. Allows registering CustomConversions.
Author:
Jon Brisbin, Oliver Gierke, Mark Paluch, Christoph Strobl
  • Field Details

    • conversionService

      protected final org.springframework.core.convert.support.GenericConversionService conversionService
    • conversions

      protected org.springframework.data.convert.CustomConversions conversions
    • instantiators

      protected org.springframework.data.mapping.model.EntityInstantiators instantiators
  • Constructor Details

    • AbstractMongoConverter

      public AbstractMongoConverter(@Nullable org.springframework.core.convert.support.GenericConversionService conversionService)
      Creates a new AbstractMongoConverter using the given GenericConversionService.
      Parameters:
      conversionService - can be null and defaults to DefaultConversionService.
  • Method Details

    • setCustomConversions

      public void setCustomConversions(org.springframework.data.convert.CustomConversions conversions)
      Registers the given custom conversions with the converter.
      Parameters:
      conversions - must not be null.
    • setInstantiators

      public void setInstantiators(@Nullable org.springframework.data.mapping.model.EntityInstantiators instantiators)
      Registers EntityInstantiators to customize entity instantiation.
      Parameters:
      instantiators - can be null. Uses default EntityInstantiators if so.
    • getConversionService

      public org.springframework.core.convert.ConversionService getConversionService()
      Specified by:
      getConversionService in interface org.springframework.data.convert.EntityConverter<MongoPersistentEntity<?>,MongoPersistentProperty,Object,org.bson.conversions.Bson>
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean