JDK-4313643 : Discovering subclasses: need to discover all subclasses of some base class
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2000-02-17
  • Updated: 2000-03-03
  • Resolved: 2000-03-03
Related Reports
Duplicate :  
Description

Name: skT88420			Date: 02/17/2000


java version "1.3.0rc1"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0rc1-T)
Java HotSpot(TM) Client VM (build 1.3.0rc1-S, mixed mode)

Feature to discover all subclasses of some base class, even if this would be
limited to all subclasses present in one package. This would enable us to make
a factory of instances without hardcoding the classnames in the factory class,
they could be instantiated through reflection...

Example
  Person -> Employee
         -> Manager
It would be nice to discover you can do something with employees or managers,
and when a class Customer is added, the application can discover this
dynamically.
(Review ID: 101370) 
======================================================================

Comments
EVALUATION Is there any more efficient way to do this than to enumerate the classes in a package and test them? Can't this be done easily enough with the existing reflection API? We do not want to suggest that we actually keep an efficient representation of the descendent classes of each class. william.maddox@Eng 2000-02-17
17-02-2000