Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to pick Classes from a package

 
Maki Jav
Ranch Hand
Posts: 447
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi,


I have a package ratio. I want to dynamically load All classes from that package that are sub class of RatioCalculation. All these classes are in that package. I don't want to hard code classes names.
Do I need to use Reflection API?

Thanks,

Maki Jav


 
Maki Jav
Ranch Hand
Posts: 447
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just found an api to do this

Reflections API

Example of picking classes in the package.





Hope it will help others too

Thanks,

Maki Jav
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic