Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.classpath
Class VMStackWalker  view VMStackWalker download VMStackWalker.java

java.lang.Object
  extended bygnu.classpath.VMStackWalker

public final class VMStackWalker
extends java.lang.Object

This class provides access to the classes on the Java stack for reflection and security purposes.

This class is only available to privileged code (i.e., code loaded by the bootstrap loader).


Constructor Summary
VMStackWalker()
           
 
Method Summary
static java.lang.Class getCallingClass()
          Get the class associated with the method invoking the method invoking this method, or null if the stack is not that deep (e.g., invoked via JNI invocation API).
static java.lang.ClassLoader getCallingClassLoader()
          Get the class loader associated with the Class returned by getCallingClass(), or null if no such class exists or it is the boot loader.
static java.lang.Class[] getClassContext()
          Get a list of all the classes currently executing methods on the Java stack.
static java.lang.ClassLoader getClassLoader(java.lang.Class cl)
          Retrieve the class's ClassLoader, or null if loaded by the bootstrap loader.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VMStackWalker

public VMStackWalker()
Method Detail

getClassContext

public static java.lang.Class[] getClassContext()
Get a list of all the classes currently executing methods on the Java stack. getClassContext()[0] is the class associated with the currently executing method, i.e., the method that called VMStackWalker.getClassContext() (possibly through reflection). So you may need to pop off these stack frames from the top of the stack:
  • VMStackWalker.getClassContext()
  • Method.invoke()


getCallingClass

public static java.lang.Class getCallingClass()
Get the class associated with the method invoking the method invoking this method, or null if the stack is not that deep (e.g., invoked via JNI invocation API). This method is an optimization for the expression getClassContext()[1] and should return the same result.

VM implementers are encouraged to provide a more efficient version of this method.


getCallingClassLoader

public static java.lang.ClassLoader getCallingClassLoader()
Get the class loader associated with the Class returned by getCallingClass(), or null if no such class exists or it is the boot loader. This method is an optimization for the expression VMStackWalker.getClassLoader(getClassContext()[1]) and should return the same result.

VM implementers are encouraged to provide a more efficient version of this method.


getClassLoader

public static java.lang.ClassLoader getClassLoader(java.lang.Class cl)
Retrieve the class's ClassLoader, or null if loaded by the bootstrap loader. I.e., this should return the same thing as VMClass.getClassLoader(java.lang.Class)>VMClass.getClassLoader(java.lang.Class) 55 . This duplicate version is here to work around access permissions.