• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem with Reflections and recursive type search

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

i tried to make a program that will be given a java class file (.class) as parameter and it will use java reflection to introspect the class, find out method, fields etc and create an XML file with the class description.

the problem is when i e.g. ask for the superclass of the class that i am inspecting and i get a Class object. now i want to get the name of that object ..but for that the class needs to be inspected too and so on and so on.

the problem is that my class loader cant find these aditional classes

example:

public MyClass extends SomeOtherClass
{
......
}

if i try to introspect the class file from MyClass i need to add to classpath SomeOtherClass and use the super.findSystemClass() in my ClassLoader to find it.

my classloader looks like this



when i use JBuilder to open a java class file it makes all the introspection and displays the class structure, the types that he cann not find he simply omits (in my case it would display public class MyClass{ ...} )

i cant get pass the exeption when i dont find the class...

another issue - i need to give to have the full binary name... eg i need to call Class.forName("net.something.mine.MyClass"), if i dont supply this full binary name then the classloader says it cant find that class...

i dont think JBuilder cares for it...it simply gets the absolute files path and it is enough for it to make the introspection

so resume of what i would like to know

1. how to bypass the recursive class introspection or ho to ignore the exeption "class not found" then introspecting innes classes

2. some workaroud the full qualified binary name (or how to get it from the class file?)

thanks for advice

best regards
Marek
reply
    Bookmark Topic Watch Topic
  • New Topic