Yup that's what i was after thanks! At least i can make it return
without pulling back the whole database now :-)
cool tnx
Jorg
Gary Gregory wrote:
Don't you mean: "exclude slot xyz", not method?
You can do this:
/**
* This method does NOT include the password in the returned String.
*
* @see java.lang.Object#toString()
*/
public String toString() {
return (new ReflectionToStringBuilder(this) {
protected boolean accept(Field f) {
return super.accept(f) &&
!f.getName().equals("password");
}
}).toString();
}
Gary
-----Original Message-----
From: news [mailto:[EMAIL PROTECTED] On Behalf Of Jorg Heymans
Sent: Friday, September 10, 2004 02:03
To: [EMAIL PROTECTED]
Subject: [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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]