Re: New Reflection/Beans API
Markus Dahm <[email protected]>
| Newsgroups | gmane.comp.jakarta.bcel.devel |
|---|---|
| Message-ID | <[email protected]> |
Stephen Colebourne wrote:
>>>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) ?
Yes,
that would probably be a good idea. Maybe I'll have time to implement that.
Cheers
Markus