Re: New Reflection/Beans API
"Stephen Colebourne" <[email protected]>
| Newsgroups | gmane.comp.jakarta.bcel.devel |
|---|---|
| Message-ID | <000601c20c1c$bff33580$694218d4@oemcomputer> |
> > Yes this is what I was driving at. Is there an easy factory method to
create
> > bytecodes equivalent to:
> > Class cl = Foo.class
>
> Currently the answer is no, but that's not to difficult, just call
> Class.forName("Foo");
What I mean is that if you decompile a Java class with this relatively
simple line, it has generated about 15 bytecodes plus a field - it lazily
instantiates the object. This will be a pain to code, but perfectly possible
(I'll just copy the decompiled code!)
> > Also, is there a convenient method to create a Type object from a Class
> > object?
>
> new ObjectType(clazz.getName()); ?
But what about primitive types and array types. I'm guessing that quite a
few projects must run into the issue of converting Class to Type. Maybe a
new factory method on Type would be appropriate - Type.getType(Class) ?
Stephen
PS. Thanks for the assistance and a great API. I was really pleased at how
easily I got up and running.