Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to pick Classes from a package

 
Maki Jav
Ranch Hand
Posts: 445
  • 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: 445
  • 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
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic