Win a copy of Terraform in Action this week in the Cloud forum!
  • 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Al Hobbs
  • salvin francis

Nested Object in Reflection API

 
Ranch Hand
Posts: 230
IntelliJ IDE Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All

Reflection API Question

I have collected Fields using for a Bean. As I do have a nested Bean so can anyone suggest me as how to read the nested Objects

I want to iterate through all the fields of a bean

e.g Bean Structure
Family
  Father
      his him half
  Mother
     her hers
  Child
    so  all of

Family has a father. Father can also have nested objects like his him half
                                  Mother can also have nested objects  like her hers
                                  Child can also have nested objects like  so all of

Thanks in Advance
 
Saloon Keeper
Posts: 13427
302
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why reflection? You can just access the properties directly, can't you?

You probably want to write some sort of recursive algorithm that retrieves whatever information you're looking for.

What information do you want to get out of the tree? Have you written a recursive algorithm before?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic