aspose file tools*
The moose likes Java in General and the fly likes Why and When to use reflections Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Why and When to use reflections" Watch "Why and When to use reflections" New topic
Author

Why and When to use reflections

Harsha Hegde
Greenhorn

Joined: Jan 12, 2009
Posts: 17

Hi folks,
I recently studied the concept of reflections in java, but I am unable to find the practical use of it?
Can anyone give a practical example where some problem can be solved only by reflection or reflection is the best way to sole that problem.
Rgds,
HH
Daesung Park
Ranch Hand

Joined: Mar 22, 2007
Posts: 68
Reflection is widely used, and dependency-injection is one of the examples.
You can describe concrete class name in your configuration file and then create an instance of the class at runtime by reflection.




Daesung Park

BLOG
arulk pillai
Author
Ranch Hand

Joined: May 31, 2007
Posts: 3223
You can also use in your custome annotations.


http://www.java2s.com/Code/Java/Language-Basics/JavaAnnotationAnnotationandReflection.htm

http://tutorials.jenkov.com/java-reflection/annotations.html


Java Interview Questions and Answers Blog | Amazon.com profile | Java Interview Books
lin qun
Greenhorn

Joined: Feb 20, 2009
Posts: 5
setter and getter methods.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39394
    
  28
To the Java Tutorials! You will find a whole section about reflection.
Kuldeep Tewari
Ranch Hand

Joined: May 22, 2006
Posts: 35
Some of the realtime examples include : your IDE's intellisense, Dynamic proxies, dependency injection etc.
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8829
    
    5
intermediate level!


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why and When to use reflections