FileDocCategorySizeDatePackage
Support_ClassLoader.javaAPI DocAndroid 1.5 API2245Wed May 06 22:41:06 BST 2009tests.support

Support_ClassLoader

public abstract class Support_ClassLoader extends Object
Support class for creating a file-based ClassLoader. Delegates to either Dalvik's PathClassLoader or the RI's URLClassLoader, but does so by-name. This allows us to run corresponding tests in both environments.

Fields Summary
Constructors Summary
Methods Summary
public abstract java.lang.ClassLoadergetClassLoader(java.net.URL url, java.lang.ClassLoader parent)

public static java.lang.ClassLoadergetInstance(java.net.URL url, java.lang.ClassLoader parent)

        try {
            Support_ClassLoader factory; 
            
            if ("Dalvik".equals(System.getProperty("java.vm.name"))) {
                factory = (Support_ClassLoader)Class.forName(
                    "tests.support.Support_ClassLoader$Dalvik").newInstance();
            } else {
                factory = (Support_ClassLoader)Class.forName(
                    "tests.support.Support_ClassLoader$RefImpl").newInstance();
            }
            
            return factory.getClassLoader(url, parent);
        } catch (Exception ex) {
            throw new RuntimeException("Unable to create ClassLoader", ex);
        }