Class SolrConverterBase

java.lang.Object
org.springframework.data.solr.core.convert.SolrConverterBase
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean, org.springframework.data.convert.EntityConverter<SolrPersistentEntity<?>,SolrPersistentProperty,Object,org.apache.solr.common.SolrDocumentBase>, org.springframework.data.convert.EntityReader<Object,org.apache.solr.common.SolrDocumentBase>, org.springframework.data.convert.EntityWriter<Object,org.apache.solr.common.SolrDocumentBase>, SolrConverter
Direct Known Subclasses:
MappingSolrConverter, SolrJConverter

public abstract class SolrConverterBase extends Object implements SolrConverter, org.springframework.beans.factory.InitializingBean
  • Constructor Details

    • SolrConverterBase

      public SolrConverterBase()
  • Method Details

    • write

      public Collection<org.apache.solr.common.SolrInputDocument> write(@Nullable Iterable<?> source)
      Description copied from interface: SolrConverter
      Write values to List of SolrInputDocument
      Specified by:
      write in interface SolrConverter
      Returns:
      empty list if values is null-
    • createAndWrite

      protected org.apache.solr.common.SolrInputDocument createAndWrite(Object source)
      create a new SolrInputDocument for given source and write values to it
      Parameters:
      source -
      Returns:
    • getCustomConversions

      public org.springframework.data.convert.CustomConversions getCustomConversions()
      Returns:
    • hasCustomReadTarget

      protected boolean hasCustomReadTarget(Class<?> sourceType, Class<?> targetType)
      Parameters:
      sourceType -
      targetType -
      Returns:
      true if custom read target defined in customConversions
    • hasCustomWriteTarget

      protected boolean hasCustomWriteTarget(Class<?> sourceType)
      Parameters:
      sourceType -
      Returns:
      true if custom write target defined in customConversions
    • hasCustomWriteTarget

      protected boolean hasCustomWriteTarget(Class<?> sourceType, Class<?> targetType)
      Parameters:
      sourceType -
      targetType -
      Returns:
      true if custom write target defined in customConversions
    • isSimpleType

      protected boolean isSimpleType(Class<?> type)
      Parameters:
      type -
      Returns:
      true if is simple type as defined in customConversions
    • getCustomWriteTargetType

      protected Optional<Class<?>> getCustomWriteTargetType(Class<?> type)
      get the target conversion type
      Parameters:
      type -
      Returns:
    • registerCustomConverters

      protected void registerCustomConverters(org.springframework.core.convert.support.GenericConversionService conversionService)
      register customConversions with conversionService
      Parameters:
      conversionService -
    • setCustomConversions

      public void setCustomConversions(@Nullable org.springframework.data.convert.CustomConversions customConversions)
      Parameters:
      customConversions -
    • getConversionService

      public org.springframework.core.convert.support.GenericConversionService getConversionService()
      Specified by:
      getConversionService in interface org.springframework.data.convert.EntityConverter<SolrPersistentEntity<?>,SolrPersistentProperty,Object,org.apache.solr.common.SolrDocumentBase>
    • canConvert

      protected boolean canConvert(Class<?> sourceType, Class<?> targetType)
      Parameters:
      sourceType -
      targetType -
      Returns:
      true if sourceType can be converted into targetType
    • convert

      @Nullable protected <T> T convert(Object source, Class<T> targetType)
      Convert given object into target type
      Parameters:
      source -
      targetType -
      Returns:
    • afterPropertiesSet

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