Skip to main content

Custom Entry Serialization

Setter methods that take in a Serializer can be used to provide custom serialization of entries instead of using the predefined serializer.

// Set an XML value instead of JSON.
config.set("key1", myAddress, XmlSerializer.DEFAULT_SQ_READABLE);
key1 =
123 Main Street
Anywhere
NY
12345

The value can then be retrieved using the equivalent parser:

Address myAddress = config.get("key1").as(XmlParser.DEFAULT, Address.class).orElse(null);