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

Add FieldUtils getAllFields() to return all the fields defined in the given class and super classes

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • None
    • 3.2
    • lang.reflect.*
    • None

    Description

      java.lang.Class.getDeclaredFields() doesn't return the fields defined by the super classes. I'd like to suggest the addition of a new method in FieldUtils that also returns the inherited fields (including the private fields).

      According to this question on StackOverflow this method would be quite useful:

      http://stackoverflow.com/questions/3567372/access-to-private-inherited-fields-via-reflection-in-java

      Attachments

        1. FieldUtils.diff
          1 kB
          nguyen phuc lam
        2. FieldUtilsTest.diff
          0.8 kB
          nguyen phuc lam
        3. FieldUtils.diff
          2 kB
          nguyen phuc lam

        Activity

          People

            Unassigned Unassigned
            ebourg Emmanuel Bourg
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: