J Cole | 3 Nov 2003 00:17
Picon

Speeding up Reflection

Hey guys, 

I have a simple requirement for some software I am developing - speeding up
Field.get() & Field.set() calls.

Does bcel have this capability? Are there any code snippets I can use? I
have checked out the API - there doesn't seem to be anything I can use to
this effect.

I was thinking of modifying the bytecode of the Field class, removing the
security checks etc. Any other thoughts?

Joe Cole
Jwahar Bammi | 4 Nov 2003 02:40

Javaclass from an URL

I am obviously missing something in readings the API docs: What is the
method to call to get a JavaClass given I know the URL to the .class file I
am trying to manipulate. I looked at all the Repository methods that are
usually used to construct the JavaClass initially, and nothing seems
appropriate.

 How about if I had the full classname to the .class file, would that help?

 Alternately, to which method could I  hand a java.IO.InputStream to get a
JavaClass back that I could then use.

Thanks in advance,

Jwahar Bammi

Memento, Inc.

bammi <at> memento-inc.com

Jwahar Bammi | 4 Nov 2003 02:45

Javaclass from URL or Filename or InputStream

Sorry: I hit send by mistake without finishing edits: 

I am obviously missing something in readings the API docs: What is the
method to call to get a JavaClass given I know the URL to the .class file I
am trying to manipulate. I looked at all the Repository methods that are
usually used to construct the JavaClass initially, and nothing seems
appropriate.
 
How about if I had the full pathname to the .class file, would that help?
 
Alternately, to which method could I hand a java.IO.InputStream to get a
JavaClass in return, that I could then use.
 
Thanks in advance,

Jwahar Bammi
Memento, Inc.
bammi <at> memento-inc.com
 
Joseph Ryan | 4 Nov 2003 03:13
Picon
Favicon

Re: Javaclass from URL or Filename or InputStream

Jwahar Bammi wrote:

>Sorry: I hit send by mistake without finishing edits: 
>
>I am obviously missing something in readings the API docs: What is the
>method to call to get a JavaClass given I know the URL to the .class file I
>am trying to manipulate. I looked at all the Repository methods that are
>usually used to construct the JavaClass initially, and nothing seems
>appropriate.
> 
>How about if I had the full pathname to the .class file, would that help?
> 
>Alternately, to which method could I hand a java.IO.InputStream to get a
>JavaClass in return, that I could then use.
>  
>

A quick glance at the docs[1] suggests that you can do:

    String url = "...";
    InputStream remote_class = ...;
    JavaClass clazz = new ClassParser(remote_class, url).parse();

- Joe

[1] - http://jakarta.apache.org/bcel/apidocs/index.html
Adrian Ber | 9 Nov 2003 17:58
Picon
Favicon

static initializer

I want to insert all the instructions from a static
initializer of a class into the static initializer of
another class (insert in front). Can someone point me
to a code sample for this?

Thanks,
Adrian.

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

Gmane