dcsimg
java-reflection
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   tisha_thampy
Posted On:   Monday, March 8, 2004 09:14 PM

What actually java reflection mechanism does?What is the advantage of using that?

Re: java-reflection

Posted By:   Glenn_Mason  
Posted On:   Wednesday, March 31, 2004 11:54 PM

The reflection API contains all kinds of stuff for dealing with unknown objects at runtime ... and not just unknown objects, but unknown types of objects.



For example, you can use it to figure out what methods are in an object, or fields, or constructors; you can execute methods, etc. without knowing before runtime what the methods will be.



Does that make sense? You can load in an unknown object, figure out it's interfaces, and use it appropriately. It's very cool for loading in plugins and stuff. (You know, load all objects out of a particular directory, then figure out which ones implement Plugin (or something) and add them to your plugin array.)

About | Sitemap | Contact