Package jodd.util.cl

Examples of jodd.util.cl.DefaultClassLoaderStrategy


    assertEquals(Dummy[].class, ClassLoaderUtil.loadClass(dummyClassName + "[]"));
    assertEquals(Dummy[][].class, ClassLoaderUtil.loadClass(dummyClassName + "[][]"));

    // special case

    DefaultClassLoaderStrategy defaultClassLoaderStrategy = (DefaultClassLoaderStrategy) JoddCore.classLoaderStrategy;

    defaultClassLoaderStrategy.setLoadArrayClassByComponentTypes(true);

    URLClassLoader parentClassloader = (URLClassLoader)this.getClass().getClassLoader();
    URL[] urls = parentClassloader.getURLs();
    ExtendedURLClassLoader excl = new ExtendedURLClassLoader(urls, parentClassloader, false);

    Class dummyClass = ClassLoaderUtil.loadClass(dummyClassName, excl);
    assertFalse(Dummy.class == dummyClass); // classes are NOT the same as they are loaded by different class loaders
    assertEquals(Dummy.class.getName(), dummyClass.getName());

    // special case with array!

    Class dummyClassArray = ClassLoaderUtil.loadClass(dummyClassName + "[]", excl);
    assertFalse(Dummy[].class == dummyClassArray);
    assertEquals(Dummy[].class.getName(), dummyClassArray.getName());

    defaultClassLoaderStrategy.setLoadArrayClassByComponentTypes(false);
  }
View Full Code Here

TOP

Related Classes of jodd.util.cl.DefaultClassLoaderStrategy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.