commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stephen Colebourne" <>
Subject Re: [lang] ToStringBuilder.reflectionToString() and statics.
Date Sat, 01 Nov 2003 19:34:08 GMT
From: "Gary Gregory" <>
> A code review would be greatly appreciated, especially in how the feature
> surfaced at the API level.
> The main points are:
> (1)
> Deprecate in ReflectionToStringBuilder:

> (2) New convenience methods ReflectionToStringBuilder.toStringWithStatics.
I thought they would make things clearer, but I was wrong!

> Ideally I would have liked not to instantiate the target object, but it
> seems that Java's lack of a proper metadata model rears its ugly head here
> again. Unless I've missed something, which is quite possible of course.
> Doing this:
> ReflectionToStringBuilder.toStringWithStatics(MQEnvironment.class
> MQEnvironment.class);
> Will dump out the contents of the java.lang.Class object and so does not
> the same as the first example. It seems that you cannot get to the static
> side info from a java.lang.Class but only from an instance. Not very OO,
> well.
You could have a   toStringStatics(Class, Class)  method. You can get the
field metadata about static methods from the Class object. The method could
only output static fields though, and I'm not sure how common the case is.


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message