Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to invoke a method of a reflected field

 
Tudor Raneti
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
SOLVED: I figured it out, the key was:


sumsNavigation is of type B that extends type A which has a protected LinkedList components; //field
It isn't possible to extend A directly from my class because of a special setup.
I need to do components.size() basically, but through reflection. I'm stuck at invoking the method, it won't accept any argument in m.invoke(sumsNavigation);.



 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic