How can use reflection to get the property names and values from a POJO?
You need to use #getDeclaredFields()
to include private fields, #getFields()
only lists the public ones.
With private
fields you will also run into access restriction problems, so you probably want to look into the Field#setAccessible()
method as well.
Instead of kls.getfields you could need to use kls.getDeclaredFields() . And if Jason object is your concern I had recommend you a Jackson Codhaus library . In which you can get or set JsonString from your POJO... HTH