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 | Class and Description |
|---|---|
static class |
MappingPdxSerializer.ExcludeAllTypesFilter |
static class |
MappingPdxSerializer.ExcludeComGemstoneGemFireTypesFilter |
static class |
MappingPdxSerializer.ExcludeJavaTypesFilter |
static class |
MappingPdxSerializer.ExcludeNullTypesFilter |
static class |
MappingPdxSerializer.ExcludeOrgSpringFrameworkTypesFilter |
| 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)
Factory method used to construct a new instance of
MappingPdxSerializer initialized with
the given ConversionService and a provided GemfireMappingContext. |
static MappingPdxSerializer |
create(GemfireMappingContext mappingContext)
Factory method used to construct a new instance of
MappingPdxSerializer initialized with
the given mapping context supplying entity mapping meta-data,
using a provided, default ConversionService. |
static MappingPdxSerializer |
create(GemfireMappingContext mappingContext,
ConversionService conversionService)
Factory method used to construct a new instance of
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.slf4j.Logger |
getLogger()
Returns a reference to the configured
Logger 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. |
protected Filter<Class<?>> |
getTypeFilters()
|
static MappingPdxSerializer |
newMappingPdxSerializer()
Factory method used to construct a new instance of
MappingPdxSerializer initialized with
a provided GemfireMappingContext and default ConversionService. |
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 |
setExcludeTypeFilters(Filter<Class<?>> typeFilters)
|
void |
setGemfireInstantiators(EntityInstantiators entityInstantiators)
Configures the
EntityInstantiators used to create the instances read by this PdxSerializer. |
void |
setGemfireInstantiators(Map<Class<?>,EntityInstantiator> gemfireInstantiators)
Configures the
EntityInstantiators used to create the instances
read by this PdxSerializer. |
void |
setIncludeTypeFilters(Filter<Class<?>> typeFilters)
|
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()
MappingPdxSerializer initialized with
a provided GemfireMappingContext and default ConversionService.MappingPdxSerializer.create(GemfireMappingContext, ConversionService),
newMappingContext(),
newConversionService()public static MappingPdxSerializer create(ConversionService conversionService)
MappingPdxSerializer initialized with
the given ConversionService and a provided GemfireMappingContext.conversionService - ConversionService used to convert persistent values to entity properties.MappingPdxSerializer initialized with the given ConversionService.ConversionService,
create(GemfireMappingContext, ConversionService),
newMappingContext()public static MappingPdxSerializer create(GemfireMappingContext mappingContext)
MappingPdxSerializer initialized with
the given mapping context supplying entity mapping meta-data,
using a provided, default ConversionService.mappingContext - GemfireMappingContext used to supply entity mapping meta-data.MappingPdxSerializer initialized with
the given mapping context.GemfireMappingContext,
create(GemfireMappingContext, ConversionService),
newConversionService()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 to map between application domain model object types
and PDX serialized bytes based on the entity's mapping meta-data.conversionService - ConversionService used to convert persistent values to entity properties.MappingPdxSerializer.ConversionService,
MappingPdxSerializerpublic void setApplicationContext(ApplicationContext applicationContext) throws BeansException
setApplicationContext in interface ApplicationContextAwareBeansExceptionprotected ConversionService getConversionService()
ConversionService used to convert data store types
to application domain object types.ConversionService.ConversionServicepublic 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(EntityInstantiators entityInstantiators)
EntityInstantiators used to create the instances read by this PdxSerializer.entityInstantiators - EntityInstantiators used to create the instances
read by this PdxSerializer; must not be null.EntityInstantiatorpublic void setGemfireInstantiators(Map<Class<?>,EntityInstantiator> gemfireInstantiators)
EntityInstantiators used to create the instances
read by this PdxSerializer.gemfireInstantiators - mapping of types to EntityInstantiator objects;
must not be null.EntityInstantiator,
>>>>>>> 3ed1599... SGF-745 - Add ability to filter types de/serialized by the o.s.d.g.mapping.MappingPdxSerializer.protected EntityInstantiators getGemfireInstantiators()
protected EntityInstantiator getInstantiatorFor(PersistentEntity entity)
entity - the PersistentEntity object used to lookup the custom EntityInstantiator.EntityInstantiator,
PersistentEntityprotected org.slf4j.Logger getLogger()
Logger used to log messages
about the functions of this PdxSerializer.Logger.Logprotected GemfireMappingContext getMappingContext()
mapping context used to handling mapping
logic between GemFire persistent entities and application domain object types.mapping context for Pivotal GemFire.GemfireMappingContextprotected 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 void setExcludeTypeFilters(Filter<Class<?>> typeFilters)
type filters used to exclude or filter types serializable
by this PDX serializer.
This operation is null-safe and rather than overriding the existing type filters,
this set operation combines the given type filters with
the exiting type filters joined by and.typeFilters - type filters used to to exclude types serializable
by this PDX serializer.Filterpublic void setIncludeTypeFilters(Filter<Class<?>> typeFilters)
type filters used to include or filter types serializable
by this PDX serializer.
This operation is null-safe and rather than overriding the existing type filters,
this set operation combines the given type filters with
the exiting type filters joined by or.typeFilters - type filters used to to include types serializable
by this PDX serializer.Filterprotected Filter<Class<?>> getTypeFilters()
type filter.Filterpublic Object fromData(Class<?> type, com.gemstone.gemfire.pdx.PdxReader reader)
fromData in interface com.gemstone.gemfire.pdx.PdxSerializerpublic boolean toData(Object value, com.gemstone.gemfire.pdx.PdxWriter writer)
toData in interface com.gemstone.gemfire.pdx.PdxSerializerCopyright © 2011–2019 Pivotal Software, Inc.. All rights reserved.