how to load classes for a particular package


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: how to load classes for a particular package

Hybrid View

  1. #1
    Join Date
    Jun 2005
    Posts
    9

    how to load classes for a particular package

    I have a package name say com.test
    i need to get the names of all the classes starting with "Test" under this package. Also, i need to get the names of all the methods starting with "test" in each of these classes.

    ideas/suggestions welcome

    cheers
    yogesh

  2. #2
    Join Date
    Feb 2004
    Posts
    541
    I imagine you mean you want to do this programatically, yes? Well the easiest way to do this would be to use Reflection. Take a look at http://java.sun.com/developer/techni...LT/Reflection/ . This lets you look at internal properties of classes, such as the names of all the methods declared.

    I'm not sure if you can use reflection to list all the classes in a paticular package, but if you can't then you can simply look in the relevant directory, find the names of all the files that end .class, and then look for ones with the right name. When you have found them you can use reflection to discover their methods.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center