<legend id='kMCXA'><style id='kMCXA'><dir id='kMCXA'><q id='kMCXA'></q></dir></style></legend>

    <small id='kMCXA'></small><noframes id='kMCXA'>

    1. <i id='kMCXA'><tr id='kMCXA'><dt id='kMCXA'><q id='kMCXA'><span id='kMCXA'><b id='kMCXA'><form id='kMCXA'><ins id='kMCXA'></ins><ul id='kMCXA'></ul><sub id='kMCXA'></sub></form><legend id='kMCXA'></legend><bdo id='kMCXA'><pre id='kMCXA'><center id='kMCXA'></center></pre></bdo></b><th id='kMCXA'></th></span></q></dt></tr></i><div id='kMCXA'><tfoot id='kMCXA'></tfoot><dl id='kMCXA'><fieldset id='kMCXA'></fieldset></dl></div>
      1. <tfoot id='kMCXA'></tfoot>

          <bdo id='kMCXA'></bdo><ul id='kMCXA'></ul>

        如何在 Eclipse 中列出 Java 类及其祖先公开的所有属性?

        How to list all properties exposed by a Java class and its ancestors in Eclipse?(如何在 Eclipse 中列出 Java 类及其祖先公开的所有属性?)
        <legend id='CiJsl'><style id='CiJsl'><dir id='CiJsl'><q id='CiJsl'></q></dir></style></legend>
          • <bdo id='CiJsl'></bdo><ul id='CiJsl'></ul>
              <tbody id='CiJsl'></tbody>
          • <tfoot id='CiJsl'></tfoot>

                • <i id='CiJsl'><tr id='CiJsl'><dt id='CiJsl'><q id='CiJsl'><span id='CiJsl'><b id='CiJsl'><form id='CiJsl'><ins id='CiJsl'></ins><ul id='CiJsl'></ul><sub id='CiJsl'></sub></form><legend id='CiJsl'></legend><bdo id='CiJsl'><pre id='CiJsl'><center id='CiJsl'></center></pre></bdo></b><th id='CiJsl'></th></span></q></dt></tr></i><div id='CiJsl'><tfoot id='CiJsl'></tfoot><dl id='CiJsl'><fieldset id='CiJsl'></fieldset></dl></div>

                • <small id='CiJsl'></small><noframes id='CiJsl'>

                  本文介绍了如何在 Eclipse 中列出 Java 类及其祖先公开的所有属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  给定一个 Java 类,我希望能够列出所有祖先中公开的所有属性,并在同样的方式.

                  Given a single Java class I'd like to be able to list all properties that are exposed in all ancestors and recursively traverse all their exposed properties (i.e. public or with getters/setters) in the same way.

                  用一个简单的例子更容易解释:

                  Easier to explain with a simple example:

                  public class BaseClass1 {
                      private int intProperty; // has getter and setter (not shown)
                  }
                  public class SubClass1 extends BaseClass1 {
                      private int privateSoNotListed;
                      public SubClass2 subClass2Property;
                  }
                  public class BaseClass2 {
                      public String stringProperty;
                  }
                  public class SubClass2 extends BaseClass2 {
                      private long longProperty; // has getter and setter (not shown)
                  }
                  

                  给定上面的 SubClass1 作为输入,输出将是这样的:

                  Given SubClass1 above as input, the output would be something like this:

                  intProperty                      - int    [from BaseClass1]
                  subClass2Property.stringProperty - String [from BaseClass2]
                  subClass2Property.longProperty   - long   [from SubClass2]
                  

                  应该可以使用一些巧妙的反射来编写这样的东西,但我宁愿不重新发明轮子 - 有没有可以做到这一点的现有工具(也许是 Eclipse 插件?)

                  It should be possible to write something like this using a bit of clever reflection but I'd rather not reinvent the wheel - is there an existing tool that can do this (perhaps an Eclipse plugin?)

                  Eclipse 的类型层次结构在显示单个类的属性方面做得很好 - 在我看来,理想的解决方案是如果这是一个树视图(类似于包资源管理器),具有以下能力扩展本身就是类的属性.

                  Eclipse's Type Hierarchy does a nice job of displaying properties for a single class - the ideal solution in my mind would be if this were a tree view (similar to Package Explorer) with the ability to expand properties that are themselves classes.

                  推荐答案

                  刚刚找到了一种有用的方法来实现与最初通过 Eclipse 的类型层次结构所要求的非常相似的东西.

                  Have just found a useful way of achieving something fairly similar to what was originally asked via Eclipse's Type Hierarchy.

                  有一个名为显示所有继承的成员"的切换按钮,如下面的红色箭头所示:

                  There is a toggle named "Show All Inherited Members" as shown by the red arrow below:

                  选择此项后,除了所选类的字段和方法外,还会显示所有超类的字段和方法(清楚地表明每个超类的来源),如下所示:

                  After selecting this, the fields and methods from all superclasses are displayed in addition to those for the selected class (with a clear indication of where each one came from), as shown below:

                  (当然,这不仅包括属性,但由于 getter 按字母顺序显示,并且有公共/私有/受保护的图标,因此可以很容易地用于获取此信息.)

                  这篇关于如何在 Eclipse 中列出 Java 类及其祖先公开的所有属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                  How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                  Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                  Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                  How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                  How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)
                  <tfoot id='wm3MD'></tfoot>

                    <tbody id='wm3MD'></tbody>
                  <i id='wm3MD'><tr id='wm3MD'><dt id='wm3MD'><q id='wm3MD'><span id='wm3MD'><b id='wm3MD'><form id='wm3MD'><ins id='wm3MD'></ins><ul id='wm3MD'></ul><sub id='wm3MD'></sub></form><legend id='wm3MD'></legend><bdo id='wm3MD'><pre id='wm3MD'><center id='wm3MD'></center></pre></bdo></b><th id='wm3MD'></th></span></q></dt></tr></i><div id='wm3MD'><tfoot id='wm3MD'></tfoot><dl id='wm3MD'><fieldset id='wm3MD'></fieldset></dl></div>
                  1. <small id='wm3MD'></small><noframes id='wm3MD'>

                      <bdo id='wm3MD'></bdo><ul id='wm3MD'></ul>

                          • <legend id='wm3MD'><style id='wm3MD'><dir id='wm3MD'><q id='wm3MD'></q></dir></style></legend>