Rob Prime wrote:But that's not without using reflection.
True (and reflection sucks to debug/maintain), but the implementation is pretty straightforward. One thing you could do is implement a toHashMap() method which builds a HashMap of the current object. Downside of that is that you'd have to implement it in every class you want that functionality and consistently update it (something you already mentioned). If you've written a bunch of code already then it would suck, but if you're just starting out it wouldn't be to bad. Just like
unit testing... update the class update the test/HashMap method.