Please do not ask how I get myself into this situation.
Lets say I have a class called ccollection
.
this class has the following attributes at runtime:
ccollection.a.b.x = 1
ccollection.a.b.y = 3
ccollection.a.b.z = 4
...
ccollection.a.c = 3
ccollection.b = 3
this class will be setup dynamically as described above. so there is no way to know the attributes in the class before hand.
Now I would like to print all the attributes in this class, for example:
ccollection.a.b
should print
ccollection.a.b.x = 1
ccollection.a.b.y = 3
ccollection.a.b.z = 4
and
ccollection.a
should print
ccollection.a.b.x = 1
ccollection.a.b.y = 3
ccollection.a.b.z = 4
ccollection.a.c = 3
I think you get the idea. Each print should starts printing all the elements at the same level and below. I am looking for a way to recursively traverse all the attributes (which is a tree-like data structure)