javaã§éçºãã¦ããæã«ããªãã¬ã¯ã·ã§ã³ã使ç¨ãã¦ã¯ã©ã¹ã®ãã£ã¼ã«ããåå¾ããã¨ãã«å°ãã¤ã¾ã£ãã®ã§ã¡ã¢ã ã¤ã¾ã£ãã㨠ã親ã¯ã©ã¹ã«å®ç¾©ããã¦ãããã£ã¼ã«ãããªãã¬ã¯ã·ã§ã³ã§åããã¨ãã§ããªãã£ããã¨ãã åå java.lang.Classã®getDeclaredField(String name) ã¯ã親ã¯ã©ã¹ã®ãã£ã¼ã«ãã¾ã§æ¤ç´¢ãã¦ãããªãã 解決ç ä¸è¨ã®ããã«ãåã¯ã©ã¹ãæ¤ç´¢ãã¦è¦ã¤ãããªããã°ãåã¯ã©ã¹.getSuperclass() ã¨ãã¦è¦ªã¯ã©ã¹ãåå¾ãã¦æ¢ç´¢ãããã§ãè¦ã¤ãããªããã°æ´ã«ãã®è¦ªã¯ã©ã¹ãæ¢ç´¢ãã¦ã»ã»ã»ãã¨ããããã«å帰çã«æ¢ç´¢ãã¦ããã public Field getFieldFromClass(Class clazz, String fieldName) throws NoSuchFieldException { Field field = null
{{#tags}}- {{label}}
{{/tags}}