-
Enhancement
-
Resolution: Duplicate
-
P4
-
None
-
1.2.0, 1.3.0
-
generic
-
generic
Name: mc57594 Date: 11/30/99
java version "1.2.2"
Classic VM (build JDK-1.2.2-W, native threads, symcjit)
The reflection capability in Java is missing one important element, the ability
for an object to list out all the classes that it can access during runtime.
Currently, if you don't know the name of the class, you can't access the
class. What would be nice is that the Package class have a method that lists
out the name of all its classes (in String format).
This is my situation...
I made an abstract CreditCard class upder a package called Payment that is the
super class of all credit card types (eg.. Visa, Mastercard, etc) What I want
to do is for the CreditCardClass to scan the Payment Package, and tell me all
the classes in that package. Then armed with a list of class names then I can
test each class to see if they are subclassed from CreditCard. This is done so
that the class CreditCard won't have to be modified when a new credit card is
written and placed in the Package.
(Review ID: 98462)
======================================================================
- duplicates
-
JDK-4313643 Discovering subclasses: need to discover all subclasses of some base class
- Closed
-
JDK-4061452 (reflect) Should provide API for reflection of packages
- Open