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 Sun, 02 Nov 2003 21:11:39 GMT
From: "Gary Gregory" <ggregory@seagullsw.com>
> > ReflectionToStringBuilder.toStringWithStatics.
> > -1
> > I thought they would make things clearer, but I was wrong!
>
> I tend to agree. I am not opposed to removing all 3 toStringWithStatics
> methods. I will wait for a confirmation before nuking to make sure this is
> what we really want. The important part is that the feature is available.
Well I'm happy to see them removed :-)
Stephen


> > 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.
>
> My current workaround works as long as it is possible to instantiate the
> desired object for which one wants the static side info. I think I'll wait
> until the non-instantiable case arises to code this up however; how XP ;-)
>
> Gary
>
> > -----Original Message-----
> > From: Stephen Colebourne [mailto:scolebourne@btopenworld.com]
> > Sent: Saturday, November 01, 2003 11:34
> > To: Jakarta Commons Developers List
> > Subject: Re: [lang] ToStringBuilder.reflectionToString() and statics.
> >
> > 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
>


---------------------------------------------------------------------
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