Reputation: 9026
If you have a Scala case class that looks like:
case class Fnord(x: Parcelable, y: Parcelable)
Where Parcelable doesn't extend Serializable, but does have a way to return a ByteArray of itself (something that does implement Serializable).
How to do you make the case class Serializable? Is there a way to do custom (de)serialization on particular fields?
(I'm solving it right now by creating a simple wrapper class that is serializable and using that in the case classes, but it'd be nice to skip that step.)
Upvotes: 3
Views: 736
Reputation: 3102
Take a look at java.io.Externalizable. It allows a class to manually serialize and restore its fields.
Upvotes: 1