Pivotal Knowledge Base

Follow

How to customize serialization with class pattern strings

Environment

Product Version
Pivotal GemFire 7.0.1.x,7.0.2.x, 8.0.0.x, 8.1.0.x,8.2.0.x,8.2.1.x

Purpose

This article demonstrates the use of class pattern strings to identify those classes that you want to serialize using GemFire's reflection-based autoserializer, as well as, how to specify object identity fields and specify fields to exclude from serialization.

Procedure

The class pattern strings used to configure the ReflectionBasedAutoSerializer are standard regular expressions. For example, the following expression would select all classes defined in the package and its subpackages from packages:

  1. 1. io.pivotal.gemfire.sample
  2. 2. io.pivotal.pdx.patterns.sample
<pdx>
<pdx-serializer>
<class-name>
com.gemstone.gemfire.pdx.ReflectionBasedAutoSerializer
</class-name>
<parameter name="classes">
<string>io\.pivotal\.gemfire\..*,io\.pivotal\.*\.patterns\.sample..*</string>
</parameter>
</pdx-serializer>
</pdx>

Note

  1. You need to provide a backslash, "\", to escape the period, ".", as package delimiter and use ".*" as a wildcard, to permit any strings, if using the regular expression.
  2. You need to use comma-separated patterns for multiple packages.

Comments

Powered by Zendesk