コード例 #1
0
ファイル: Class.java プロジェクト: justinsb/robovm
  /**
   * Returns the class loader which was used to load the class represented by this {@code Class}.
   * Implementations are free to return {@code null} for classes that were loaded by the bootstrap
   * class loader. The Android reference implementation, though, returns a reference to an actual
   * representation of the bootstrap class loader.
   *
   * @return the class loader for the represented class.
   * @see ClassLoader
   */
  public ClassLoader getClassLoader() {
    if (this.isPrimitive()) {
      return null;
    }

    ClassLoader loader = getClassLoaderImpl();
    if (loader == null) {
      loader = BootClassLoader.getInstance();
    }
    return loader;
  }
コード例 #2
0
ファイル: Class.java プロジェクト: justinsb/robovm
 /**
  * This must be provided by the VM vendor, as it is used by other provided class implementations
  * in this package. Outside of this class, it is used by SecurityManager.classLoaderDepth(),
  * currentClassLoader() and currentLoadedClass(). Return the ClassLoader for this Class without
  * doing any security checks. The bootstrap ClassLoader is returned, unlike getClassLoader() which
  * returns null in place of the bootstrap ClassLoader.
  *
  * @return the ClassLoader
  */
 ClassLoader getClassLoaderImpl() {
   ClassLoader loader = getClassLoader(this);
   return loader == null ? BootClassLoader.getInstance() : loader;
 }