Using some ideas from the flexible solution I was getting an exception
on the nullSaveGet method:
object is not an instance of declaring class.
So I changed:
valueOfMethod.invoke(enumClass, new Object [] {ordinal});
to
valueOfMethod.invoke(enumClass.getEnumConstants()[0], new Object []
{ordinal});
Did anyone else run into this? Is there a better way of doing this? |