code: public static Class<?> getStreamerClass (Object object)
      {
          return (object instanceof Enum<?>) ?
              ((Enum<?>)object).getDeclaringClass() : object.getClass();
      }
docs: Returns the class that should be used when streaming this object. In general that is the
  object's natural class, but for enum values, that might be its declaring class as enums use
  classes in a way that would otherwise pollute our id to class mapping space.