commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ben short" <...@benshort.co.uk>
Subject Re: [Lang] ToStringBuilder Question
Date Thu, 19 Apr 2007 09:49:05 GMT
Hi Gary,

I was using version 2.2 but have tried it again with version 2.3. Same result.
I also tried the following code.

ToStringBuilder.reflectionToString(request)

But that produces the same output.

Interestingly if i do the same but with one of my domain object,
instead of the HttpServletRequest I see an expected result.

Looking at the javadoc it states..

[SNIP]
Alternatively, there is a method that uses reflection to determine the
fields to test. Because these fields are usually private, the method,
reflectionToString, uses AccessibleObject.setAccessible to change the
visibility of the fields. This will fail under a security manager,
unless the appropriate permissions are set up correctly. It is also
slower than testing explicitly.
[SNIP]

I wonder if this has anything todo with it?

Regards

Ben

On 4/19/07, Gary Gregory <ggregory@seagullsoftware.com> wrote:
> Hello Ben:
>
> It should be possible indeed. This is the kind of thing with which this builder was designed
and tested. Make sure you are using the current version of lang (2.3). Does it happen if you
use the single arg method?
>
> If you take a peek at the unit tests you'll see that the class is tested to output fields
from nested objects to any depth. So I really wonder what is going on.
>
> You could also write a test case with no external dependencies if you need to file a
JIRA ticket.
>
> Thank you,
> Gary
>
> > -----Original Message-----
> > From: jamin.short@gmail.com [mailto:jamin.short@gmail.com] On Behalf Of ben
> > short
> > Sent: Wednesday, April 18, 2007 8:11 AM
> > To: commons-user@jakarta.apache.org
> > Subject: [Lang] ToStringBuilder Question
> >
> > Hi,
> >
> > Im trying to use the ToStringBuilder as follows,
> >
> > ToStringBuilder.reflectionToString(request, ToStringStyle.MULTI_LINE_STYLE)
> >
> > the output I get is....
> >
> > org.apache.catalina.connector.RequestFacade@19bd8b4[
> >   request=org.apache.catalina.connector.Request@1acf711
> > ]
> >
> >
> > I was hoping that the output would be more verbose and output all of
> > the request properties.
> >
> > Is this possible?
> >
> > Regards
> >
> > Ben
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: commons-user-help@jakarta.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-user-help@jakarta.apache.org
>
>

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