toString template, generate getters for field.

Hi,

maybe I'm missing something; I cannot figure out, how generate getters in toString, instead of field references.

There's

$method.fieldName String The name of the field this getter method covers - null if the                  method is not a getter for a field


but I cannot see other way around. How to get getter name out of field name stored in $member.name  ($member.accessor will return field name for some reason).

thanks.
Mar.
2 comments
Comment actions Permalink

Iterate through methods and use $method.getter in the condition?

0
Comment actions Permalink

Thanks for reply. I already tried that, but I think that does not work. When generating toString, popup is displayed with field and methods from which one have to select which should be used in toString. And even if in given class there exist getter for given field, in this dialog will be listed field and not method. And each selected field goes into $members collection, while only methods, not having javabean-related field will be added into $methods. Usually $methods will be empty. Theoretically I could iterate over all methods in class and find one with matching name, but I did not find variable with all class methods ($methods is initialized from that dialog).

Mar.

0

Please sign in to leave a comment.