Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Reflection  RSS feed

 
kedar parundekar
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In which application reflection is usefull?
 
Jan Groth
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just one case:

loading properties from a config file which describe a class to be used.

take the log4j configuration as an example, you write "ConsoleAppender" or "FileAppender" in it. Or "BilboBagginsAppender".

somewhere in log4j a line of code will be like this


impossible to be solved without reflection :-)

jan
 
Jan Groth
Ranch Hand
Posts: 456
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
btw: read "one from many cases"...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!