groovy.lang.GroovyClassLoader.getParent()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.9k)|赞(0)|评价(0)|浏览(189)

本文整理了Java中groovy.lang.GroovyClassLoader.getParent()方法的一些代码示例,展示了GroovyClassLoader.getParent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。GroovyClassLoader.getParent()方法的具体详情如下:
包路径:groovy.lang.GroovyClassLoader
类名称:GroovyClassLoader
方法名:getParent

GroovyClassLoader.getParent介绍

暂无

代码示例

代码示例来源:origin: org.codehaus.groovy/groovy

private static boolean isFromAnotherClassLoader(GroovyClassLoader loader, String fileName) {
  ClassLoader parent = loader.getParent();
  return parent != null && parent.getResource(fileName) != null;
}

代码示例来源:origin: org.codehaus.groovy/groovy

return cu.getClassLoader().getParent().loadClass(main);
} catch (ClassNotFoundException e3) {}

代码示例来源:origin: org.codehaus.groovy/groovy-jdk14

/**
 * Get the <code>ClassLoader</code> that will serve as the parent ClassLoader of the
 * {@link GroovyClassLoader} in which scripts will be executed. By default, this is the
 * ClassLoader that loaded the <code>GroovyScriptEngine</code> class.
 *
 * @return parent classloader used to load scripts
 */
public ClassLoader getParentClassLoader() {
  return groovyLoader.getParent();
}

代码示例来源:origin: org.kohsuke.droovy/groovy

/**
 * Get the <code>ClassLoader</code> that will serve as the parent ClassLoader of the
 * {@link GroovyClassLoader} in which scripts will be executed. By default, this is the
 * ClassLoader that loaded the <code>GroovyScriptEngine</code> class.
 *
 * @return parent classloader used to load scripts
 */
public ClassLoader getParentClassLoader() {
  return groovyLoader.getParent();
}

代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal

/**
 * Get the <code>ClassLoader</code> that will serve as the parent ClassLoader of the
 * {@link GroovyClassLoader} in which scripts will be executed. By default, this is the
 * ClassLoader that loaded the <code>GroovyScriptEngine</code> class.
 *
 * @return parent classloader used to load scripts
 */
public ClassLoader getParentClassLoader() {
  return groovyLoader.getParent();
}

代码示例来源:origin: org.codehaus.groovy/groovy-jdk14

private void initGroovyLoader(final ClassLoader parentClassLoader) {
  if (groovyLoader == null || groovyLoader.getParent() != parentClassLoader) {
    groovyLoader = AccessController.doPrivileged(new PrivilegedAction<GroovyClassLoader>() {
      public GroovyClassLoader run() {
        ScriptClassLoader loader;
        if (parentClassLoader instanceof GroovyClassLoader)
          loader = new ScriptClassLoader((GroovyClassLoader) parentClassLoader);
        else
          loader = new ScriptClassLoader(parentClassLoader);
        return loader;
      }
    });
  }
}

代码示例来源:origin: org.kohsuke.droovy/groovy

/**
 * Initialize a new GroovyClassLoader with the parentClassLoader passed as a parameter.
 * A GroovyScriptEngine should only use one GroovyClassLoader but since in version
 * prior to 1.0-RC-01 you could set a new parentClassLoader
 * Ultimately groovyLoader should be final and only set in the constructor
 *
 * @param parentClassLoader the class loader to use
 */
private void initGroovyLoader(final ClassLoader parentClassLoader) {
  if (groovyLoader == null || groovyLoader.getParent() != parentClassLoader) {
    groovyLoader =
        (GroovyClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
          public Object run() {
            ScriptClassLoader loader;
            if (parentClassLoader instanceof GroovyClassLoader)
              loader = new ScriptClassLoader((GroovyClassLoader)parentClassLoader);
            else
              loader = new ScriptClassLoader(parentClassLoader);
            return loader;
          }
        });
  }
}

代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal

/**
 * Initialize a new GroovyClassLoader with the parentClassLoader passed as a parameter.
 * A GroovyScriptEngine should only use one GroovyClassLoader but since in version
 * prior to 1.0-RC-01 you could set a new parentClassLoader
 * Ultimately groovyLoader should be final and only set in the constructor
 *
 * @param parentClassLoader the class loader to use
 */
private void initGroovyLoader(final ClassLoader parentClassLoader) {
  if (groovyLoader == null || groovyLoader.getParent() != parentClassLoader) {
    groovyLoader =
        (GroovyClassLoader) AccessController.doPrivileged(new PrivilegedAction() {
          public Object run() {
            ScriptClassLoader loader;
            if (parentClassLoader instanceof GroovyClassLoader)
              loader = new ScriptClassLoader((GroovyClassLoader)parentClassLoader);
            else
              loader = new ScriptClassLoader(parentClassLoader);
            return loader;
          }
        });
  }
}

代码示例来源:origin: javax.faces/jsf-impl

@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
  if (name == null) {
    throw new NullPointerException();
  }
  Class<?> c;
  try {
    c = gse.getGroovyClassLoader().getParent().loadClass(name);
  } catch (ClassNotFoundException cnfe) {
    try {
      c = gse.loadScriptByName(name);
    } catch (Exception e) {
      throw new ClassNotFoundException(name, e);
    }
  }
  if (c == null) {
    throw new ClassNotFoundException(name);
  }
  return c;
}

代码示例来源:origin: com.thinkaurelius.groovy-shaded-asm/groovy-shaded-asm

return cu.getClassLoader().getParent().loadClass(main);
} catch (ClassNotFoundException e3) {}

代码示例来源:origin: org.codehaus.groovy/groovy-jdk14

return cu.getClassLoader().getParent().loadClass(main);
} catch (ClassNotFoundException e3) {}

代码示例来源:origin: org.codehaus.groovy/groovy-all-minimal

return cu.getClassLoader().getParent().loadClass(main);
} catch (ClassNotFoundException e3) {}

代码示例来源:origin: org.kohsuke.droovy/groovy

return cu.getClassLoader().getParent().loadClass(main);
} catch (ClassNotFoundException e3) {}

相关文章