| Author |
iterate to all List type property of my objects recursively
|
Jay Richards
Ranch Hand
Joined: Jan 16, 2003
Posts: 58
|
|
Hi, maybe some expert in reflection can help me with my problem. i need a way to access a List property on my object, but this must also recursively parse any List property it may find on the List Object. just a simple traversing with system.out will do. please help. thanks.
|
 |
Stan James
(instanceof Sidekick)
Ranch Hand
Joined: Jan 29, 2003
Posts: 8791
|
|
|
Look into reflection, ie using the methods on the Class class. Look at the JavaDoc for Class getFields() and getDeclaredFields(). Many frameworks that convert objects to XML or move objects in and out of databases use these tricks to get and set fields. Take a shot at making them work from the doc and let us know how it goes!
|
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
|
 |
Jay Richards
Ranch Hand
Joined: Jan 16, 2003
Posts: 58
|
|
hi, just wanna share listing the properties of a class and checking if its a list was easy ReflectionUtils just posted my code just in case someone needs a similar approach. hth,
|
 |
 |
|
|
subject: iterate to all List type property of my objects recursively
|
|
|