Posted By:
Dan_Winterstein
Posted On:
Wednesday, May 24, 2006 05:17 AM
When using getDeclaredFields() to access a class's fields, on of the fields it returns is the 'this' field. That is, a field whose value is the object. This is throwing my program into an infinite loop, so I want to filter it out. What's the best way of doing so? It seems to always be last in the array returned by getDeclaredFields, so I could throw away the last value. Alternatively, it has names suchs as "this$0" which I could test for. Neither of these seem good solutions - they both depend upon non-api behaviour. Is there a 'proper' way to identify the 'this' field? Many thanks for any help, - Dan
More>>
When using getDeclaredFields() to access a class's fields, on of the fields it returns is the 'this' field. That is, a field whose value is the object.
This is throwing my program into an infinite loop, so I want to filter it out. What's the best way of doing so?
It seems to always be last in the array returned by getDeclaredFields, so I could throw away the last value.
Alternatively, it has names suchs as "this$0" which I could test for. Neither of these seem good solutions - they both depend upon non-api behaviour. Is there a 'proper' way to identify the 'this' field?
Many thanks for any help,
- Dan
<<Less