Adding return value support for enumeration (both Java and C++