Class objects are generally not amenable to serialising via reflection. It is significantly easier to simply store the full class name and instantiate the class object from the name when you need it.
You could achieve this by either changing your Value
class to store the class name as a String
instead of the class object, or by changing how Value
gets serialised.
For the second option, this can be done either by making Value
implement DataSerializable
, or by registering a DataSerializer
for Value