Use real objects for enumerations

* Java erases the Enumeration types at runtime, so they cannot easily be
  serialized/deserialized.