Create a Reflector by class name form ClassLoader

@param name        class full name
@param classLoader ClassLoader
@return Reflector
@throws ReflectException ReflectException
@see #with(Class)
169607
public static Reflector with(String name, ClassLoader classLoader) throws ReflectException {
        return with(getClassForName(name, classLoader));
    }
833974
public static void setPreferredClassLoader(ClassLoader classLoader) {
		if (classLoader != dynamicLoader) {
			dynamicLoader = classLoader;
			final Thread[] threads = new Thread[Thread.activeCount()];
			Thread.enumerate(threads);
			for (final Thread t : threads) {
				if (t != null) {
					t.setContextClassLoader(classLoader);
				}
			}
		}
	}
790705
public static Class forName(String className, ClassLoader loader) {
        try {
            return loader.loadClass(className);
        } catch (ClassNotFoundException e) {
            if (aliasClassMap.containsKey(className)) {
                return aliasClassMap.get(className);
            }

            throw new BeanMappingException("forName class[" + className + "] is error!", e);
        }
    }
1318718
@SuppressWarnings("unchecked")
	public T newInstance(ClassLoader classLoader) {
		try {
			return (T) compile(classLoader).getConstructor(Object[].class)
					// Because Constructor.newInstance(Object... initargs), we need to load
					// references into a new Object[], otherwise it cannot be compiled.
					.newInstance(new Object[] {references});
		} catch (Exception e) {
			throw new RuntimeException(
				"Could not instantiate generated class '" + className + "'", e);
		}
	}
1310651
public static Class<?> loadClass(String classname) {
        Class<?> c = null;

        // First try a simple Class.forName()
        try { c = Class.forName(classname); } catch (ClassNotFoundException e) { }
        // Didn't work?  Try using this class's classloader.
        if (c == null) {
            try { c = ReflectionUtils.class.getClassLoader().loadClass(classname); } catch (ClassNotFoundException e) { }
        }
        // Still didn't work?  Try the thread's context classloader.
        if (c == null) {
            try { c = Thread.currentThread().getContextClassLoader().loadClass(classname); } catch (ClassNotFoundException e) { }
        }

        return c;
    }
263890
public static Object instantiateObject(String className,
                                           ClassLoader classLoader) {
        Object object;
        try {
            object = loadClass(className, classLoader).newInstance();
        } catch ( Throwable e ) {
            throw new RuntimeException( "Unable to instantiate object for class '" + className + "'",
                                        e );
        }
        return object;
    }
66959
@SuppressWarnings("static-method")
	protected ClassLoader createClassLoader(Iterable<File> jarsAndFolders, ClassLoader parentClassLoader) {
		return new URLClassLoader(Iterables.toArray(Iterables.transform(jarsAndFolders, from -> {
			try {
				final URL url = from.toURI().toURL();
				assert url != null;
				return url;
			} catch (Exception e) {
				throw new RuntimeException(e);
			}
		}), URL.class), parentClassLoader);
	}
1324677
@SuppressWarnings( "unchecked" )
    private <T> Class<T> loadClassIfVisible( String className, ClassLoader classLoader )
    {
        try
        {
            Class<T> klass = (Class<T>) classLoader.loadClass( className );
            return klass;
        }
        catch ( ClassNotFoundException e )
        {
            return null;
        }
    }
176342
@Override
  public Class loadClass(String name) throws ClassNotFoundException {

    if (bestCandidate != null) {
      try {
        return bestCandidate.loadClass(name);
      } catch (Throwable t) {
        bestCandidate = null;
      }
    }

    Throwable throwable = null;
    Class clazz = null;
    ClassLoadHelper loadHelper = null;

    Iterator<ClassLoadHelper> iter = loadHelpers.iterator();
    while (iter.hasNext()) {
      loadHelper = iter.next();

      try {
        clazz = loadHelper.loadClass(name);
        break;
      } catch (Throwable t) {
        throwable = t;
      }
    }

    if (clazz == null) {
      if (throwable instanceof ClassNotFoundException) {
        throw (ClassNotFoundException) throwable;
      } else {
        throw new ClassNotFoundException(
            String.format("Unable to load class %s by any known loaders.", name), throwable);
      }
    }

    bestCandidate = loadHelper;

    return clazz;
  }
416282
public Class loadClass(String name)
    {
        try
        {
            return classLoader.loadClass( name );
        }
        catch (ClassNotFoundException notFound)
        {
            return null;
        }
        catch (NoClassDefFoundError notFound)
        {
            return null;
        }
    }
844241
public ISarlClassBuilder addSarlClass(String name) {
		ISarlClassBuilder builder = this.iSarlClassBuilderProvider.get();
		builder.eInit(getSarlBehavior(), name, getTypeResolutionContext());
		return builder;
	}
393034
@Override
	public Loader createLoader(ClassLoader parent) {

        if( log.isDebugEnabled() )
            log.debug("Creating Loader with parent class loader '" +
                       parent + "'");

        WebappLoader loader = new WebappLoader(parent);
        return (loader);

    }
661166
public Class<?> getClassByName(String name) throws ClassNotFoundException {
        Map<String, Class<?>> map = CACHE_CLASSES.get(classLoader);
        if (map == null) {
            Map<String, Class<?>> newMap = new ConcurrentHashMap<>();
            map = CACHE_CLASSES.putIfAbsent(classLoader, newMap);
            if (map == null) {
                map = newMap;
            }
        }

        Class clazz = map.get(name);
        if (clazz == null) {
            clazz = Class.forName(name, true, classLoader);
            if (clazz != null) {
                map.put(name, clazz);
            }
        }

        return clazz;
    }
429528
@Override
    @Trivial
    public void addClassLoader(ClassLoader classLoader) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
            Tr.debug(tc, "addClassLoader - " + classLoader);
        }

        if (classLoader instanceof ContainerClassLoader) {
            synchronized (classLoaders) {
                classLoaders.add((ContainerClassLoader) classLoader);
            }
        } else {
            throw new IllegalArgumentException("classLoader is not a ContainerClassLoader");
        }
    }
101415
public static JavaCompilerUtil create(ClassLoader loader)
  {
    JavacConfig config = JavacConfig.getLocalConfig();

    String javac = config.getCompiler();

    JavaCompilerUtil javaCompiler = new JavaCompilerUtil();

    if (loader == null) {
      loader = Thread.currentThread().getContextClassLoader();
    }

    javaCompiler.setClassLoader(loader);
    javaCompiler.setCompiler(javac);
    javaCompiler.setArgs(config.getArgs());
    javaCompiler.setEncoding(config.getEncoding());
    javaCompiler.setMaxBatch(config.getMaxBatch());
    javaCompiler.setStartTimeout(config.getStartTimeout());
    javaCompiler.setMaxCompileTime(config.getMaxCompileTime());

    return javaCompiler;
  }
756192
public static Object instantiate(String type, ClassLoader classLoader) {
        try {
            return ClassUtils.forName(type, classLoader)
                .flatMap(InstantiationUtils::tryInstantiate)
                .orElseThrow(() -> new InstantiationException("No class found for name: " + type));
        } catch (Throwable e) {
            throw new InstantiationException("Could not instantiate type [" + type + "]: " + e.getMessage(), e);
        }
    }
334172
protected Class<?> classForName(String name) {
        try {
            return resourceLoader.classForName(name);
        } catch (ResourceLoadingException cnfe) {
            return DUMMY_CLASS;
        }
    }