commons-dev mailing list archives

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

> (2) New convenience methods ReflectionToStringBuilder.toStringWithStatics.
-1
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
do
> 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,
oh
> 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.

Stephen



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message