You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@commons.apache.org by Jorg Heymans <jh...@domek.be> on 2004/09/10 11:02:31 UTC
[Lang] reflectionToString on large objectgraphs
Hi,
I am trying to get something useful out of
ToStringBuilder.reflectionToString() for my purpose. The objects i am
trying to display are generated from a database schema. Some of them are
in a many-to-many relationship, which does not help when trying to
display some of the objects with the ToStringBuilder. Eg: a building has
a one or more category and a category can belong to one or more
buildings. (try this with about 20000 buildings and 40 categories)
I know i can limit the introspection by superclass but as these are all
POJO's so that doesn't really help me. Is there another way around this?
Something like "traverse the object graph only in one direction" or
"exclude method xyz" from traversal ?
Regards
Jorg Heymans
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org
Re: [Lang] reflectionToString on large objectgraphs
Posted by "matthew.hawthorne" <ma...@apache.org>.
Jorg Heymans wrote:
> I am trying to get something useful out of
> ToStringBuilder.reflectionToString() for my purpose. The objects i am
> trying to display are generated from a database schema. Some of them are
> in a many-to-many relationship, which does not help when trying to
> display some of the objects with the ToStringBuilder. Eg: a building has
> a one or more category and a category can belong to one or more
> buildings. (try this with about 20000 buildings and 40 categories)
>
> I know i can limit the introspection by superclass but as these are all
> POJO's so that doesn't really help me. Is there another way around this?
> Something like "traverse the object graph only in one direction" or
> "exclude method xyz" from traversal ?
I don't believe that ToStringBuilder currently allows this type of
customization.
One option would be to use Betwixt or Xstream to convert your tree to
XML, then use Xpath to select only the data that you want.
But, with the amount of data that you speak of (20000 buildings), this
may require more memory than it's worth.
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org