commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "matthew.hawthorne" <ma...@apache.org>
Subject Re: [Lang] reflectionToString on large objectgraphs
Date Fri, 10 Sep 2004 13:41:23 GMT
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


Mime
View raw message