• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Bear Bibeault
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Jj Roberts
  • Tim Holloway
  • Piet Souris
Bartenders:
  • Himai Minh
  • Carey Brown
  • salvin francis

print java bean member variables and values

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a requirement to print the member variables and their values of a java bean object. I am thinking of using reflection to perform this task.
But the challenge is, if one of the member variable happens to be another java bean then the member variable and values of that bean also needs to be printed.
I am not sure how I can verify if a particular member variable is a java object or not. More specifically, the difficult part is to differentiate between jdk java objects(like String, Boolean, etc.,) and the custom java objects.
Do you have any ideas in accomplishing this?

Thanks...
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have you come across the class java.beans.XMLEncoder? It might do what you need already.
 
James Kesari
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This class is great. But the only problem is, if the bean object contains a collection object as its member variable then it does not drill down further.

any suggestions please?
 
These are not the droids you are looking for. Perhaps I can interest you in a tiny ad?
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
reply
    Bookmark Topic Watch Topic
  • New Topic