Results 1 to 6 of 6
Thread: Problem in Reflection API
- 08-17-2008, 04:54 PM #1
Member
- Join Date
- Aug 2008
- Posts
- 3
- Rep Power
- 0
Problem in Reflection API
Hi All,
I am using the Reflection API for the first time...
can anybody help me in retrieving the package name if only name of a class is known in a program...
for eg.
if in my program i give String as an input.. my program should search for its package and display its all declared functions...
thanks
rnd
- 08-17-2008, 05:42 PM #2
Some confusion with the above. A package contains classes.search for its package and display its all declared functions...
A class has methods and fields.
There are classes to access each of these.
What classes and methods in the Class class have you tried so far? Have you written any code to see what you get back from the various Class methods?
- 08-17-2008, 06:05 PM #3
- 08-18-2008, 06:52 AM #4
Member
- Join Date
- Aug 2008
- Posts
- 3
- Rep Power
- 0
No,
actually i am making a program like eclipse where if for eg. i write
Array a=new Array();
aa.
at dot a key event is generated at the text area... and it pops up all the methods of that class....
i have used
Class.forName(String) method for it, but it gives an exception ClassNotFound ... coz i am just passing "Array"and it needs the whole path as "java.util.Array"....
So,I like my program to find "java.util" as soon as "Array" is given as an argument....
- 08-18-2008, 02:00 PM #5
To find the path to a file, you'll need to search all paths to find it.
Since the package is an unknown value, all possible paths will have to be searched.
Perhaps you could presearch the jar file containing all the java classes and create a Hashtable with the class name as key and all the paths to that class as the value.
- 08-19-2008, 12:44 PM #6
Member
- Join Date
- Aug 2008
- Posts
- 3
- Rep Power
- 0
Similar Threads
-
Object Reflection: Setting value
By Java Tip in forum java.langReplies: 0Last Post: 04-23-2008, 08:13 PM -
Class Reflection: Is it an interface
By Java Tip in forum java.langReplies: 0Last Post: 04-23-2008, 08:10 PM -
Array Reflection: Multi Array Reflection
By Java Tip in forum java.langReplies: 0Last Post: 04-23-2008, 08:08 PM -
Getting method names using Reflection
By Java Tip in forum Java TipReplies: 0Last Post: 01-24-2008, 03:18 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks