« Return to Thread: [Lang] excluding Fields in ReflectionToStringBuilder

[Lang] excluding Fields in ReflectionToStringBuilder

by nodje :: Rate this Message:

Reply to Author | View in Thread

Hi,

I'm using ReflectionToStringBuilder to build a default toString() for all my Hibernate entities.
It creates problem with non initialized Fields when outside of an open session.

Basically, I'd like to be able to exclude all entity subobjects by putting them in ExcludeFieldNames so that they don't get accessed.

I can't see any way to do that with the actual implementation. Do you think it's possible at all with the actual 2.4 implementation? What about 2.5.

If not, I'll certainly have to implement my own ReflectionToStringBuilder with the ability of exluding fields that are <? extends ModelObject>. I wish I woudn't have to use 'instanceof' but I can't see any other way.

thanks for your help.

 « Return to Thread: [Lang] excluding Fields in ReflectionToStringBuilder