next up previous contents
Next: Summary and Conclusions Up: Working Notes Through the Previous: Alternatives   Contents

Questions

Can we get a Class object for an interface or an abstract class? Yes. Class::newInstance() throws an InstantiationException if you try to instantiate an abstract class, interface or a primitive type.

Overriden methods- Need to call getMethod() on the superclass's Class to get access to a method that is overriden in some subclass? Yes.

The Class::getMethod(..) method takes an array of classes and tries to match them with the parameter types of (possibly overloaded) methods with the specified name. What if the classes in the array are subclasses of the classes of the real parameters of a method? It does not work and will not be able to find the method.

Security checks on obtaining Class instances?- see Security section above.

What are PUBLIC and DECLARED? See above. The Reflection API only distinguishes between public and non-public class members when it is performing safety checks. In addition, it provides two different sets methods for (1) getting all PUBLIC members of a class (including inherited members) and (2) getting all DECLARED members of a class (including protected, private members but not any inherited members). See The Java Programming Language for some description of that.


next up previous contents
Next: Summary and Conclusions Up: Working Notes Through the Previous: Alternatives   Contents
Nadeem Hamid 2000-07-24