[prev in list] [next in list] [prev in thread] [next in thread] 

List:       bcel-user
Subject:    AW: Reflection && BCEL - Types
From:       <m.dahm () 4flow ! de>
Date:       2002-02-26 9:34:31
[Download RAW message or body]


Hi,

Neither void, nor int are "classes" of course, but primitive types.
Type objects for primitive types are listed in the Type class, e.g.,
Type.INT

If you want to map the String "int" to a sigature, use
Utility.getSignature() which
will yield "I". To convert a signature to a Type object you can then
say Type.getType(sig).

Cheers
	Markus
> -----Ursprungliche Nachricht-----
> Von: Andreas Schlapbach [mailto:schlpbch@iam.unibe.ch]
> Gesendet: Montag, 25. Februar 2002 20:11
> An: bcel-user@jakarta.apache.org
> Betreff: Reflection && BCEL - Types
> 
> 
> <div class="moz-text-flowed" style="font-family: -moz-fixed">Hi List
> 
> I'm using BCEL to subclass existing classes and interfaces on the fly.
> So I use java reflection to gain insight on the to be subclassed
> classes. But I'm not sure how to effectly map the java types to BCEL.
> 
> For example:
> 
> class A {
>      void b(int a);
> }
> 
> returns a Class of type 'void' as return type and a Class 
> 'int' as it's
> argument type. (This part of JAVA is, let's say, strange :))
> 
> If I want to subclass from A and overwrite b I need to 
> generate a class
> B and a method b with exactly this signature.
> 
> But the MethodGen classes uses it's own Type system.
> 
> Now, is there an easy way to map this java types on to the BCEL types?
>   From looking at the API and the source I couldn't find a smooth way.
> 
> Something like
> |*
> MethodGen <cid:part1.08000801.04070005@iam.unibe.ch>*(int 
> access_flags,
>      Class return_type,
>      Class[] arg_types,
>      java.lang.String[] arg_names,
>      java.lang.String method_name,
>      java.lang.String class_name,
>      InstructionList <cid:part2.03090105.02090807@iam.unibe.ch> il,
>      ConstantPoolGen <cid:part3.05030604.02050104@iam.unibe.ch>  cp)|
> 
> would be nice.
> 
> Or is there a better approach?
> 
> Andreas
> 
> --
> I think, so IAM.
> 
> Andreas Schlapbach            schlpbch@kde.org
> http://www.iam.unibe.ch/~schlpbch
> 
> 
> 
> 
> 
> 
> </div>
> 
> 
> --
> To unsubscribe, e-mail:   
<mailto:bcel-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail:
<mailto:bcel-user-help@jakarta.apache.org>


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic