public class MappingPdxSerializer extends Object implements com.gemstone.gemfire.pdx.PdxSerializer, ApplicationContextAware
PdxSerializer
implementation that uses a
GemfireMappingContext
to read and write entities.Constructor and Description |
---|
MappingPdxSerializer()
Creates a new
MappingPdxSerializer using the default
GemfireMappingContext and DefaultConversionService . |
MappingPdxSerializer(GemfireMappingContext mappingContext,
ConversionService conversionService)
|
Modifier and Type | Method and Description |
---|---|
Object |
fromData(Class<?> type,
com.gemstone.gemfire.pdx.PdxReader reader) |
protected ConversionService |
getConversionService() |
protected com.gemstone.gemfire.pdx.PdxSerializer |
getCustomSerializer(Class<?> type)
Looks up and returns a custom PdxSerializer based on the class type of the object to (de)serialize.
|
protected Map<Class<?>,com.gemstone.gemfire.pdx.PdxSerializer> |
getCustomSerializers() |
protected org.springframework.data.convert.EntityInstantiators |
getGemfireInstantiators() |
protected org.springframework.data.convert.EntityInstantiator |
getInstantiatorFor(org.springframework.data.mapping.PersistentEntity entity)
Looks up and returns an EntityInstantiator to construct and initialize an instance of the object defined
by the given PersistentEntity (meta-data).
|
protected GemfireMappingContext |
getMappingContext() |
protected GemfirePersistentEntity<?> |
getPersistentEntity(Class<?> entityType)
Looks up and returns the PersistentEntity meta-data for the given entity class type.
|
void |
setApplicationContext(ApplicationContext applicationContext) |
void |
setCustomSerializers(Map<Class<?>,com.gemstone.gemfire.pdx.PdxSerializer> customSerializers)
Configures custom PDX serializers to use for specific class types.
|
void |
setGemfireInstantiators(Map<Class<?>,org.springframework.data.convert.EntityInstantiator> gemfireInstantiators)
Configures the
EntityInstantiator s used to create the instances read by this PdxSerializer. |
boolean |
toData(Object value,
com.gemstone.gemfire.pdx.PdxWriter writer) |
public MappingPdxSerializer(GemfireMappingContext mappingContext, ConversionService conversionService)
mappingContext
- must not be null.conversionService
- must not be null.public MappingPdxSerializer()
MappingPdxSerializer
using the default
GemfireMappingContext
and DefaultConversionService
.public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext
in interface ApplicationContextAware
BeansException
protected ConversionService getConversionService()
public void setCustomSerializers(Map<Class<?>,com.gemstone.gemfire.pdx.PdxSerializer> customSerializers)
customSerializers
- a mapping of domain object class types and their corresponding PDX serializer.protected Map<Class<?>,com.gemstone.gemfire.pdx.PdxSerializer> getCustomSerializers()
public void setGemfireInstantiators(Map<Class<?>,org.springframework.data.convert.EntityInstantiator> gemfireInstantiators)
EntityInstantiator
s used to create the instances read by this PdxSerializer.gemfireInstantiators
- must not be null.protected org.springframework.data.convert.EntityInstantiators getGemfireInstantiators()
protected GemfireMappingContext getMappingContext()
public Object fromData(Class<?> type, com.gemstone.gemfire.pdx.PdxReader reader)
fromData
in interface com.gemstone.gemfire.pdx.PdxSerializer
public boolean toData(Object value, com.gemstone.gemfire.pdx.PdxWriter writer)
toData
in interface com.gemstone.gemfire.pdx.PdxSerializer
protected com.gemstone.gemfire.pdx.PdxSerializer getCustomSerializer(Class<?> type)
type
- the Class type of the object to (de)serialize.getCustomSerializers()
,
PdxSerializer
protected org.springframework.data.convert.EntityInstantiator getInstantiatorFor(org.springframework.data.mapping.PersistentEntity entity)
entity
- the PersistentEntity object used to lookup the custom EntityInstantiator.EntityInstantiator
,
PersistentEntity
protected GemfirePersistentEntity<?> getPersistentEntity(Class<?> entityType)
entityType
- the Class type of the actual persistent entity, application domain object class.getMappingContext()
,
GemfirePersistentEntity