java.lang.ClassLoader.findLoadedClass()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(3.7k)|赞(0)|评价(0)|浏览(263)

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

ClassLoader.findLoadedClass介绍

[英]Returns the class with the specified name if it has already been loaded by the VM or null if it has not yet been loaded.
[中]如果VM已加载该类,则返回具有指定名称的类;如果尚未加载,则返回null。

代码示例

代码示例来源:origin: kilim/kilim

public boolean isLoaded(String className) {
    return super.findLoadedClass(className) != null;
  }
}

代码示例来源:origin: voldemort/voldemort

public Class<?> loadClass(String className, byte[] classBuffer, int offset, int length) {
  Class<?> loadedClass = super.findLoadedClass(className);
  if(null == loadedClass) {
    return super.defineClass(className, classBuffer, offset, length);
  }
  return loadedClass;
}

代码示例来源:origin: robovm/robovm

Class<?> clazz = findLoadedClass(className);

代码示例来源:origin: stackoverflow.com

if(ClassLoader.getSystemClassLoader().findLoadedClass("java.lang.String") != null){
  System.out.println("Yepee, String is loaded !");
}

代码示例来源:origin: stackoverflow.com

Class<?> c = findLoadedClass(name);
if( c != null ) return c;

代码示例来源:origin: stackoverflow.com

throws ClassNotFoundException {
Class<?> c = findLoadedClass(name);
if (c == null) {
  if (system != null) {

代码示例来源:origin: stackoverflow.com

Class<?> cls = findLoadedClass(name);
System.err.println("findLoadedClass(" + name + ") = " + cls
    + ", has class loader " + cls.getClassLoader());

代码示例来源:origin: ibinti/bugvm

Class<?> clazz = findLoadedClass(className);

代码示例来源:origin: com.bugvm/bugvm-rt

Class<?> clazz = findLoadedClass(className);

代码示例来源:origin: com.gluonhq/robovm-rt

Class<?> clazz = findLoadedClass(className);

代码示例来源:origin: FlexoVM/flexovm

Class<?> clazz = findLoadedClass(className);

代码示例来源:origin: MobiVM/robovm

Class<?> clazz = findLoadedClass(className);

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

Class<?> clazz = findLoadedClass(className);

代码示例来源:origin: stackoverflow.com

public Class<?> loadClass(String name) throws ClassNotFoundException {
 Class<?> loadedClass = findLoadedClass(name);
 if (loadedClass != null) {
  return loadedClass;

代码示例来源:origin: stackoverflow.com

public Class<?> loadClass(String name) throws ClassNotFoundException {
  if(moduleClasses.contains(name)) {
    Class<?> clazz = findLoadedClass(name);
    if(clazz != null) {
      return clazz;

代码示例来源:origin: stackoverflow.com

protected Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
  synchronized (getClassLoadingLock(name)) {
    Class c = findLoadedClass(name);
    if (c == null) {
      try {

代码示例来源:origin: org.jvnet.jaxb1.maven2/maven-jaxb1-plugin

Class c = findLoadedClass(name);

代码示例来源:origin: stackoverflow.com

throws IOException, ClassNotFoundException,
                IllegalAccessException, InstantiationException {
Class myClass = findLoadedClass (packageName + className);
if (myClass != null)
    return myClass;

代码示例来源:origin: org.apache.beam/beam-sdks-java-core

@Override
 public Class<?> loadClass(final String name) throws ClassNotFoundException {
  final Class<?> alreadyLoaded = super.findLoadedClass(name);
  if (alreadyLoaded != null) {
   return alreadyLoaded;
  }

  if (name != null && test.test(name)) {
   try {
    final String classAsResource = name.replace('.', '/') + ".class";
    final byte[] classBytes =
      ByteStreams.toByteArray(getParent().getResourceAsStream(classAsResource));
    return defineClass(name, classBytes, 0, classBytes.length);
   } catch (final IOException e) {
    throw new RuntimeException(e);
   }
  }
  return getParent().loadClass(name);
 }
}

代码示例来源:origin: org.webpieces/runtimecompile

public Class<?> loadApplicationClassImpl(String name) {
  Class<?> maybeAlreadyLoaded = super.findLoadedClass(name);
  if(maybeAlreadyLoaded != null) {
    return maybeAlreadyLoaded;

相关文章