O'Reilly logo

Component Development for the Java™ Platform by Stuart Dabbs Halloway

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7.8. Generating Custom Serialization Code

Serialization is the perfect example of a generic service. Simply mark your object as Serializable, and at runtime the ObjectOutputStream class and friends will use reflection to extract/construct your object's instance state. Unfortunately, default serialization's heavy use of reflection imposes a performance penalty that is noticeable in some situations. In Chapter 4, you saw several options for manually customizing serialization. Some of these options could be used to improve serialization performance, but they would require you to hand-author the serialization code.

Generative programming offers an attractive middle ground. A generator can use reflection to generate custom code that is more efficient ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required