Hi,
I am not sure, but I think it is possible to implement "FieldReplacement"
as inner class and generate code like this:
class SomeClass{
private void myMethod(){
..................................
}
static class MethodReplacement{
static final int _myMethod=0;
..............................................
public Object invoke( Object obj, int methodId, Object args[] )Throws
Something{
switch( id ){ // dispach
case _myMethod : // name mapped to ID
if(isAccessible( _myMethod )){
myMethod();
} else throw new SomeExeption();
return null;
................
}
}
}
This will not work for classes in "java*" package.
At 20:25 2002.05.15 -0700, Charles Lloyd wrote:
>I am trying to write a replacement for java.lang.reflect.Method and Field
>using BCEL. I have everything working nicely except I cannot figure out
>how to emulate the setAccessible(true) feature which allows for access
>(via reflection) to protected and private Methods and Fields.
>
>Suggestions or examples greatly appreciated.
>
>Charles.
>
>
>--
>To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>