简体   繁体   English

使用反射访问受保护的类

[英]access protected class using reflection

How could I access protected class by means of reflection? 如何通过反射访问受保护的类?
This one does not work: 这一项不起作用:

Class.forName("java.awt.AWTInvocationLock");

该类是EventQueue的内部类,因此完整路径为:

    Class.forName("java.awt.EventQueue$1AWTInvocationLock");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用反射读取类中定义的受保护注释 - Reading protected annotation defined in a class using reflection 类无法使用来自不同包的反射来访问其自己的受保护的成员变量 - Class can't access its own protected member variable using reflection from different package Java反射 - 访问受保护的字段 - Java reflection - access protected field IllegalAccessException:尝试使用反射访问隐藏的类 - IllegalAccessException: Try to access hidden class using reflection 访问类的字段而不使用反射? - Access to class' Fields without using reflection? 无法使用反射访问 @ConfigurationProperties 类的变量? - Not able to access variables of @ConfigurationProperties class using reflection? 有没有办法在没有反射的情况下从不同的运行时包访问受保护的类成员? - Is there a way to access protected class members from different runtime package without reflection? Tomcat 8无法通过反射访问受保护的成员 - Tomcat 8 cannot access protected member via reflection 在Java中是否可以在不使用反射的情况下从其他非子类调用受保护的方法? - Is it possible in Java to call a protected method from a different non-child class without using reflection? 使用反射实例化受保护的构造方法时,出现NoSuchMethodException - NoSuchMethodException when using reflection to instantiate protected constructor
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM