Spring Data Solr

org.springframework.data.solr.core.convert
Class MappingSolrConverter

java.lang.Object
  extended by org.springframework.data.solr.core.convert.SolrConverterBase
      extended by org.springframework.data.solr.core.convert.MappingSolrConverter
All Implemented Interfaces:
Aware, InitializingBean, ApplicationContextAware, EntityConverter<SolrPersistentEntity<?>,SolrPersistentProperty,Object,Map<String,?>>, EntityReader<Object,Map<String,?>>, EntityWriter<Object,Map<String,?>>, SolrConverter

public class MappingSolrConverter
extends SolrConverterBase
implements SolrConverter, ApplicationContextAware, InitializingBean

Implementation of SolrConverter to read/write org.apache.solr.common.SolrDocumen/ SolrInputDocument.

Author:
Christoph Strobl

Constructor Summary
MappingSolrConverter(MappingContext<? extends SolrPersistentEntity<?>,SolrPersistentProperty> mappingContext)
           
 
Method Summary
 MappingContext<? extends SolrPersistentEntity<?>,SolrPersistentProperty> getMappingContext()
           
protected  Object getValue(SolrPersistentProperty property, Object source, Object parent)
           
<R> R
read(Class<R> type, Map<String,?> source)
           
<S,R> List<R>
read(org.apache.solr.common.SolrDocumentList source, Class<R> type)
          Read SolrDocumentList and convert to List of given type
protected
<S> S
read(TypeInformation<S> targetTypeInformation, Map<String,?> source)
           
 void setApplicationContext(ApplicationContext applicationContext)
           
 void write(Object source, Map target)
           
protected  void write(Object source, Map target, SolrPersistentEntity<?> entity)
           
protected  void write(TypeInformation<?> type, Object source, Map target)
           
 
Methods inherited from class org.springframework.data.solr.core.convert.SolrConverterBase
afterPropertiesSet, canConvert, convert, createAndWrite, getConversionService, getCustomConversions, getCustomWriteTargetType, hasCustomReadTarget, hasCustomWriteTarget, hasCustomWriteTarget, isSimpleType, registerCutomConverters, setCustomConversions, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.springframework.data.solr.core.convert.SolrConverter
write
 
Methods inherited from interface org.springframework.data.convert.EntityConverter
getConversionService
 
Methods inherited from interface org.springframework.beans.factory.InitializingBean
afterPropertiesSet
 

Constructor Detail

MappingSolrConverter

public MappingSolrConverter(MappingContext<? extends SolrPersistentEntity<?>,SolrPersistentProperty> mappingContext)
Method Detail

getMappingContext

public MappingContext<? extends SolrPersistentEntity<?>,SolrPersistentProperty> getMappingContext()
Specified by:
getMappingContext in interface EntityConverter<SolrPersistentEntity<?>,SolrPersistentProperty,Object,Map<String,?>>

read

public <S,R> List<R> read(org.apache.solr.common.SolrDocumentList source,
                          Class<R> type)
Description copied from interface: SolrConverter
Read SolrDocumentList and convert to List of given type

Specified by:
read in interface SolrConverter
Returns:
empty list if source == null || source.isEmpty()

read

public <R> R read(Class<R> type,
                  Map<String,?> source)
Specified by:
read in interface EntityReader<Object,Map<String,?>>

read

protected <S> S read(TypeInformation<S> targetTypeInformation,
                     Map<String,?> source)

getValue

protected Object getValue(SolrPersistentProperty property,
                          Object source,
                          Object parent)

write

public void write(Object source,
                  Map target)
Specified by:
write in interface EntityWriter<Object,Map<String,?>>

write

protected void write(TypeInformation<?> type,
                     Object source,
                     Map target)

write

protected void write(Object source,
                     Map target,
                     SolrPersistentEntity<?> entity)

setApplicationContext

public void setApplicationContext(ApplicationContext applicationContext)
                           throws BeansException
Specified by:
setApplicationContext in interface ApplicationContextAware
Throws:
BeansException

Spring Data Solr

Copyright © 2011-2014-2014 Pivotal. All Rights Reserved.