• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Devaka Cooray
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Saloon Keepers:
  • Tim Holloway
Bartenders:

How To: Java Reflection for has-a-relationship?

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Ranchers,

I'm willing to define a map with key as methodName and value as related 'java.lang.reflect.Method'. However the problem is, to get the methods of the class member -[which should/is an user defined class/object].

e.g:


So, how can I solve:

1. Get methods dynamically [java.lang.reflect] of class B [eg: class/es which has specific annotation '@Entity'], within/from class A?
2. Both the classes has same field type & name 'String value'. How to add/get it to/from my map collection?

Note: Using HashMap<String,Method>.

Thank you in advance!
 
Marshal
Posts: 81618
593
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Too difficult a question for beginners. Moving.
 
The first person to drink cow's milk. That started off as a dare from this tiny ad:
The new gardening playing cards kickstarter is now live!
https://www.kickstarter.com/projects/paulwheaton/garden-cards
reply
    Bookmark Topic Watch Topic
  • New Topic