• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java reflection and List

 
Edward Chen
Ranch Hand
Posts: 798
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I have
java.Util.List<Address> addressList;

how could I use java reflection to get the "Address" info in the above?

Thanks.
 
Keith Lynn
Ranch Hand
Posts: 2409
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you mean determine what the type parameter was?

Remember that type information is erased by the compiler.
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
With other words, you couldn't.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic