public class MappingPdxSerializer extends Object implements com.gemstone.gemfire.pdx.PdxSerializer, ApplicationContextAware
PdxSerializer
implementation using the Spring Data GemFire GemfireMappingContext
to read and write entities from/to GemFire PDX bytes.PdxReader
,
PdxSerializer
,
PdxWriter
,
ApplicationContext
,
ApplicationContextAware
,
ConversionService
,
EntityInstantiator
,
PersistentEntity
,
PersistentProperty
,
PersistentPropertyAccessor
,
ConvertingPropertyAccessor
,
PersistentEntityParameterValueProvider
Modifier and Type | Field and Description |
---|---|
protected org.apache.commons.logging.Log |
log |
Constructor and Description |
---|
MappingPdxSerializer()
Constructs a new instance of
MappingPdxSerializer using a default GemfireMappingContext
and DefaultConversionService . |
MappingPdxSerializer(GemfireMappingContext mappingContext,
ConversionService conversionService)
Constructs a new instance of
MappingPdxSerializer initialized with the given
GemfireMappingContext and ConversionService . |
Modifier and Type | Method and Description |
---|---|
static MappingPdxSerializer |
create(ConversionService conversionService) |
static MappingPdxSerializer |
create(GemfireMappingContext mappingContext) |
static MappingPdxSerializer |
create(GemfireMappingContext mappingContext,
ConversionService conversionService)
Factory method used to construct a new instance of the
MappingPdxSerializer initialized with
the given mapping context and conversion service . |
Object |
fromData(Class<?> type,
com.gemstone.gemfire.pdx.PdxReader reader) |
protected ConversionService |
getConversionService()
Returns a reference to the configured
ConversionService used to convert data store types
to application domain object types. |
protected com.gemstone.gemfire.pdx.PdxSerializer |
getCustomPdxSerializer(PersistentProperty<?> property)
Returns a custom PDX serializer for the given
entity persistent property . |
protected Map<?,com.gemstone.gemfire.pdx.PdxSerializer> |
getCustomPdxSerializers()
Returns a
mapping of application domain types to custom
PDX serializers used to customize the serialization
for specific application domain types . |
protected com.gemstone.gemfire.pdx.PdxSerializer |
getCustomSerializer(Class<?> type)
Deprecated.
please use
getCustomPdxSerializer(PersistentProperty) instead. |
protected Map<Class<?>,com.gemstone.gemfire.pdx.PdxSerializer> |
getCustomSerializers()
Deprecated.
please use
getCustomPdxSerializers() instead. |
protected EntityInstantiators |
getGemfireInstantiators() |
protected EntityInstantiator |
getInstantiatorFor(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 org.apache.commons.logging.Log |
getLogger()
Returns a reference to the configured
Log used to log messages
about the functions of this PdxSerializer . |
protected GemfireMappingContext |
getMappingContext()
Returns a reference to the configured
mapping context used to handling mapping
logic between GemFire persistent entities and application domain object types . |
protected GemfirePersistentEntity<?> |
getPersistentEntity(Class<?> entityType)
Looks up and returns the
PersistentEntity meta-data for the given entity Class type. |
protected GemfirePersistentEntity<?> |
getPersistentEntity(Object entity)
Looks up and returns the
PersistentEntity meta-data for the given entity object. |
static MappingPdxSerializer |
newMappingPdxSerializer() |
void |
setApplicationContext(ApplicationContext applicationContext) |
void |
setCustomPdxSerializers(Map<?,com.gemstone.gemfire.pdx.PdxSerializer> customPdxSerializers)
Configures custom
PDX serializers used to customize the serialization for specific
application domain types . |
void |
setCustomSerializers(Map<Class<?>,com.gemstone.gemfire.pdx.PdxSerializer> customSerializers)
Deprecated.
please use (
setCustomPdxSerializers(Map) instead. |
void |
setGemfireInstantiators(Map<Class<?>,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()
MappingPdxSerializer
using a default GemfireMappingContext
and DefaultConversionService
.public MappingPdxSerializer(GemfireMappingContext mappingContext, ConversionService conversionService)
MappingPdxSerializer
initialized with the given
GemfireMappingContext
and ConversionService
.mappingContext
- GemfireMappingContext
used by the MappingPdxSerializer
to map
between application domain object types and PDX serialized bytes based on the entity mapping meta-data.conversionService
- ConversionService
used by the MappingPdxSerializer
to convert
PDX serialized data to application object property types.IllegalArgumentException
- if either the GemfireMappingContext
or the ConversionService
is null.public static MappingPdxSerializer newMappingPdxSerializer()
public static MappingPdxSerializer create(ConversionService conversionService)
public static MappingPdxSerializer create(GemfireMappingContext mappingContext)
public static MappingPdxSerializer create(GemfireMappingContext mappingContext, ConversionService conversionService)
MappingPdxSerializer
initialized with
the given mapping context
and conversion service
.
If either the mapping context
or the conversion service
are null, then this factory method will provide default instances for each.mappingContext
- GemfireMappingContext
used by the MappingPdxSerializer
to map
between application domain object types and PDX serialized bytes based on the entity mapping meta-data.conversionService
- ConversionService
used by the MappingPdxSerializer
to convert
PDX serialized data to application object property types.MappingPdxSerializer
.ConversionService
,
MappingPdxSerializer
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext
in interface ApplicationContextAware
BeansException
protected ConversionService getConversionService()
ConversionService
used to convert data store types
to application domain object types.ConversionService
.ConversionService
public void setCustomPdxSerializers(Map<?,com.gemstone.gemfire.pdx.PdxSerializer> customPdxSerializers)
PDX serializers
used to customize the serialization for specific
application domain types
.customPdxSerializers
- mapping
containing custom PDX serializers
used to customize the serialization of specific application domain types
.IllegalArgumentException
- if the custom PDX serializer mapping
is null.PdxSerializer
,
Map
@Deprecated public void setCustomSerializers(Map<Class<?>,com.gemstone.gemfire.pdx.PdxSerializer> customSerializers)
setCustomPdxSerializers(Map)
instead.protected Map<?,com.gemstone.gemfire.pdx.PdxSerializer> getCustomPdxSerializers()
mapping
of application domain types
to custom
PDX serializers
used to customize the serialization
for specific application domain types
.mapping
of application domain types
to custom PDX serializers
.PdxSerializer
,
Map
@Deprecated protected Map<Class<?>,com.gemstone.gemfire.pdx.PdxSerializer> getCustomSerializers()
getCustomPdxSerializers()
instead.protected com.gemstone.gemfire.pdx.PdxSerializer getCustomPdxSerializer(PersistentProperty<?> property)
entity persistent property
.property
- PersistentProperty
of the entity used to lookup the custom PDX serializer.PdxSerializer
for the given entity PersistentProperty
,
or null if no custom PdxSerializer
could be found.PdxSerializer
@Deprecated protected com.gemstone.gemfire.pdx.PdxSerializer getCustomSerializer(Class<?> type)
getCustomPdxSerializer(PersistentProperty)
instead.public void setGemfireInstantiators(Map<Class<?>,EntityInstantiator> gemfireInstantiators)
EntityInstantiator
s used to create the instances read by this PdxSerializer.gemfireInstantiators
- must not be null.protected EntityInstantiators getGemfireInstantiators()
protected EntityInstantiator getInstantiatorFor(PersistentEntity entity)
entity
- the PersistentEntity object used to lookup the custom EntityInstantiator.EntityInstantiator
,
PersistentEntity
protected org.apache.commons.logging.Log getLogger()
Log
used to log messages
about the functions of this PdxSerializer
.Log
.Log
protected GemfireMappingContext getMappingContext()
mapping context
used to handling mapping
logic between GemFire persistent entities and application domain object types
.mapping context
for Pivotal GemFire.GemfireMappingContext
protected GemfirePersistentEntity<?> getPersistentEntity(Object entity)
PersistentEntity
meta-data for the given entity object.entity
- actual persistent entity, application domain object.PersistentEntity
meta-data for the given entity object.GemfirePersistentEntity
,
getPersistentEntity(Class)
protected GemfirePersistentEntity<?> getPersistentEntity(Class<?> entityType)
PersistentEntity
meta-data for the given entity Class
type.entityType
- Class
type of the actual persistent entity, application domain object Class
.PersistentEntity
meta-data for the given entity Class
type.GemfirePersistentEntity
,
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
Copyright © 2011–2018 Pivotal Software, Inc.. All rights reserved.