How to customize serialization with class pattern strings
search cancel

How to customize serialization with class pattern strings

book

Article ID: 294194

calendar_today

Updated On:

Products

VMware Tanzu Gemfire

Issue/Introduction

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

Environment


Resolution

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 sub-packages from the packages:

io.pivotal.gemfire.sample
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.


Additional Information

Environment

ProductVersion
Pivotal GemFire7.0.1.x,7.0.2.x, 8.0.0.x, 8.1.0.x,8.2.0.x,8.2.1.x