Spring Data Solr

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

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

public abstract class SolrConverterBase
extends Object
implements SolrConverter, InitializingBean

Author:
Christoph Strobl

Constructor Summary
SolrConverterBase()
           
 
Method Summary
 void afterPropertiesSet()
           
protected  boolean canConvert(Class<?> sourceType, Class<?> targetType)
           
protected
<T> T
convert(Object source, Class<T> targetType)
          Convert given object into target type
protected  org.apache.solr.common.SolrInputDocument createAndWrite(Object source)
          create a new SolrInputDocument for given source and write values to it
 GenericConversionService getConversionService()
           
 CustomConversions getCustomConversions()
           
protected  Class<?> getCustomWriteTargetType(Class<?> type)
          get the target conversion type
protected  boolean hasCustomReadTarget(Class<?> sourceType, Class<?> targetType)
           
protected  boolean hasCustomWriteTarget(Class<?> sourceType)
           
protected  boolean hasCustomWriteTarget(Class<?> sourceType, Class<?> targetType)
           
protected  boolean isSimpleType(Class<?> type)
           
protected  void registerCutomConverters(GenericConversionService conversionService)
          register customConversions with conversionService
 void setCustomConversions(CustomConversions customConversions)
           
 Collection<org.apache.solr.common.SolrInputDocument> write(Iterable<?> source)
          Write values to List of SolrInputDocument
 
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
read
 
Methods inherited from interface org.springframework.data.convert.EntityConverter
getMappingContext
 
Methods inherited from interface org.springframework.data.convert.EntityReader
read
 
Methods inherited from interface org.springframework.data.convert.EntityWriter
write
 

Constructor Detail

SolrConverterBase

public SolrConverterBase()
Method Detail

write

public Collection<org.apache.solr.common.SolrInputDocument> write(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 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 Class<?> getCustomWriteTargetType(Class<?> type)
get the target conversion type

Parameters:
type -
Returns:

registerCutomConverters

protected void registerCutomConverters(GenericConversionService conversionService)
register customConversions with conversionService

Parameters:
conversionService -

setCustomConversions

public void setCustomConversions(CustomConversions customConversions)
Parameters:
customConversions -

getConversionService

public GenericConversionService getConversionService()
Specified by:
getConversionService in interface EntityConverter<SolrPersistentEntity<?>,SolrPersistentProperty,Object,Map<String,?>>

canConvert

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

convert

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 InitializingBean

Spring Data Solr

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