Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-503

GetterMethodsReflectionToStringBuilder (code attached, proposal for integration)

    Details

    • Type: Improvement
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.4
    • Fix Version/s: Review Patch
    • Component/s: lang.builder.*
    • Labels:
      None

      Description

      The ReflectionToStringBuilder "reflects" on fields... I needed one that works based on public getters().

      This is useful for example with some kind of value objects where the internal private field structure is not really what you would want to see in a toString(), but which have a series of getters which were exactly what was frequently required to be dumped. There is probably other uses too (e.g. works even with a SecurityManager - that's not what I wrote it for, but could be an advantage over the ReflectionToStringBuilder?).

      I have hacked this and will attach a GetterMethodsReflectionToStringBuilder.java (which extends ReflectionToStringBuilder; works fine, for my use) with a GetterMethodsReflectionToStringBuilderTest (which may need some coverage extension, but is certainly a valid basic unit test) with its SomeTestBean. I'll attach for your consideration to integrate this.

        Attachments

        1. SomeTestBean.java
          1.0 kB
          Michael Vorburger
        2. GetterMethodsReflectionToStringBuilderTest.java
          1 kB
          Michael Vorburger
        3. GetterMethodsReflectionToStringBuilder.java
          7 kB
          Michael Vorburger

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                vorburger Michael Vorburger
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated: