How to store an arbitrary object in a Mail using ArbitrarySerializable?

martijn brinkers <[email protected]>
Newsgroups gmane.comp.jakarta.james.user
Message-ID <CAJRz6kF2_u4_2XENt0czteLqseMxd2bjADRS-gkW3Kc6dHT4ag@mail.gmail.com>
I'm in the process of converting code for James 2.X to 3.8.

I'm having some trouble storing an instance of an arbitrary class as a Mail
attribute.

James 2.X supported storing Serializable objects directly as an Mail
attribute. In James 3.X this was changed to a specialized procedure using
JSON serialization.

It looks like I need to implement ArbitrarySerializable to support storing
arbitrary objects. There is example implementation of ArbitrarySerializable
but that's only a simple example supporting an Integer which works because
AttributeValue.of already supports Integer's.

Can someone help me with an example on how to store complex objects as a
Mail attribute?

Kind regards,

Martijn Brinkers
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.