8.9.1. Using JavaBeans Persistence for Arbitrary Data

JavaBeans persistence is not limited to the storage of Swing components. You can use the mechanism to store any collection of objects, provided you follow a few simple rules. In the following sections, you will learn how you can use JavaBeans persistence as a long-term storage format for your own data.

The XMLEncoder has built-in support for the following types:

null

• All primitive types and their wrappers

• Enumerations (since Java SE 6)

String

• Arrays

• Collections and maps

• The reflection types Class, Field, Method, and Proxy

• The AWT types Color, Cursor, Dimension, Font, Insets, Point, Rectangle, and ImageIcon

• AWT and Swing components, borders, layout managers, and models

• Event ...

Get Core Java® Volume II—Advanced Features, Ninth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.