java.lang.ClassLoader Java Examples
The following examples show how to use
java.lang.ClassLoader.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AnnotationUrlProvider.java From play-sitemap-module.edulify.com with Apache License 2.0 | 6 votes |
@Override public void addUrlsTo(WebSitemapGenerator generator) { String baseUrl = configuration.getString("sitemap.baseUrl"); ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); Reflections reflections = new Reflections("controllers", new MethodAnnotationsScanner()); Set<Method> actions = reflections.getMethodsAnnotatedWith(SitemapItem.class); for(Method method : actions) { String actionUrl = actionUrl(classLoader, method); SitemapItem annotation = method.getAnnotation(SitemapItem.class); if(annotation != null) { WebSitemapUrl url = webSitemapUrl(baseUrl, actionUrl, annotation); generator.addUrl(url); } } }
Example #2
Source File: SecuritySupport.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
static ClassLoader getParentClassLoader(final ClassLoader cl) { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader parent = null; try { parent = cl.getParent(); } catch (SecurityException ex) { } // eliminate loops in case of the boot // ClassLoader returning itself as a parent return (parent == cl) ? null : parent; } }); }
Example #3
Source File: SecuritySupport.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
static ClassLoader getSystemClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = ClassLoader.getSystemClassLoader(); } catch (SecurityException ex) { } return cl; } }); }
Example #4
Source File: SecuritySupport.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
public static InputStream getResourceAsStream(final ClassLoader cl, final String name) { return (InputStream) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { InputStream ris; if (cl == null) { ris = Object.class.getResourceAsStream("/" + name); } else { ris = cl.getResourceAsStream(name); } return ris; } }); }
Example #5
Source File: SecuritySupport.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Figure out which ClassLoader to use. */ public static ClassLoader findClassLoader() { if (System.getSecurityManager()!=null) { //this will ensure bootclassloader is used return null; } else { return SecuritySupport.class.getClassLoader(); } }
Example #6
Source File: SystemDispatcher.java From androidnative.pri with Apache License 2.0 | 5 votes |
public static void loadClass(String className) { try { ClassLoader classLoader = SystemDispatcher.class.getClassLoader(); Class aClass = Class.forName(className,true,classLoader); // Log.d(TAG,"Class Loaded: " + className); } catch (ClassNotFoundException e) { Log.e(TAG,"Failed to load class: " + className); e.printStackTrace(); } }
Example #7
Source File: SecuritySupport.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
static ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); }
Example #8
Source File: SecuritySupport.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
static ClassLoader getSystemClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = ClassLoader.getSystemClassLoader(); } catch (SecurityException ex) { } return cl; } }); }
Example #9
Source File: SecuritySupport.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
static ClassLoader getParentClassLoader(final ClassLoader cl) { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader parent = null; try { parent = cl.getParent(); } catch (SecurityException ex) { } // eliminate loops in case of the boot // ClassLoader returning itself as a parent return (parent == cl) ? null : parent; } }); }
Example #10
Source File: SecuritySupport.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Figure out which ClassLoader to use. */ public static ClassLoader findClassLoader() { if (System.getSecurityManager()!=null) { //this will ensure bootclassloader is used return null; } else { return SecuritySupport.class.getClassLoader(); } }
Example #11
Source File: SecuritySupport.java From hottub with GNU General Public License v2.0 | 5 votes |
static ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); }
Example #12
Source File: SecuritySupport.java From hottub with GNU General Public License v2.0 | 5 votes |
static ClassLoader getSystemClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = ClassLoader.getSystemClassLoader(); } catch (SecurityException ex) { } return cl; } }); }
Example #13
Source File: SecuritySupport.java From hottub with GNU General Public License v2.0 | 5 votes |
static ClassLoader getParentClassLoader(final ClassLoader cl) { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader parent = null; try { parent = cl.getParent(); } catch (SecurityException ex) { } // eliminate loops in case of the boot // ClassLoader returning itself as a parent return (parent == cl) ? null : parent; } }); }
Example #14
Source File: SecuritySupport.java From hottub with GNU General Public License v2.0 | 5 votes |
public static InputStream getResourceAsStream(final ClassLoader cl, final String name) { return (InputStream) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { InputStream ris; if (cl == null) { ris = Object.class.getResourceAsStream("/" + name); } else { ris = cl.getResourceAsStream(name); } return ris; } }); }
Example #15
Source File: SecuritySupport.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Figure out which ClassLoader to use. */ public static ClassLoader findClassLoader() { if (System.getSecurityManager()!=null) { //this will ensure bootclassloader is used return null; } else { return SecuritySupport.class.getClassLoader(); } }
Example #16
Source File: SecuritySupport.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
static ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); }
Example #17
Source File: SecuritySupport.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
static ClassLoader getSystemClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = ClassLoader.getSystemClassLoader(); } catch (SecurityException ex) { } return cl; } }); }
Example #18
Source File: SecuritySupport.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
static ClassLoader getParentClassLoader(final ClassLoader cl) { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader parent = null; try { parent = cl.getParent(); } catch (SecurityException ex) { } // eliminate loops in case of the boot // ClassLoader returning itself as a parent return (parent == cl) ? null : parent; } }); }
Example #19
Source File: SecuritySupport.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
public static InputStream getResourceAsStream(final ClassLoader cl, final String name) { return (InputStream) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { InputStream ris; if (cl == null) { ris = Object.class.getResourceAsStream("/" + name); } else { ris = cl.getResourceAsStream(name); } return ris; } }); }
Example #20
Source File: SecuritySupport.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
/** * Figure out which ClassLoader to use. */ public static ClassLoader findClassLoader() { if (System.getSecurityManager()!=null) { //this will ensure bootclassloader is used return null; } else { return SecuritySupport.class.getClassLoader(); } }
Example #21
Source File: SecuritySupport.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
static ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); }
Example #22
Source File: SecuritySupport.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
static ClassLoader getSystemClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = ClassLoader.getSystemClassLoader(); } catch (SecurityException ex) { } return cl; } }); }
Example #23
Source File: SecuritySupport.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
static ClassLoader getParentClassLoader(final ClassLoader cl) { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader parent = null; try { parent = cl.getParent(); } catch (SecurityException ex) { } // eliminate loops in case of the boot // ClassLoader returning itself as a parent return (parent == cl) ? null : parent; } }); }
Example #24
Source File: SecuritySupport.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
public static InputStream getResourceAsStream(final ClassLoader cl, final String name) { return (InputStream) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { InputStream ris; if (cl == null) { ris = Object.class.getResourceAsStream("/" + name); } else { ris = cl.getResourceAsStream(name); } return ris; } }); }
Example #25
Source File: SecuritySupport.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Figure out which ClassLoader to use. */ public static ClassLoader findClassLoader() { if (System.getSecurityManager()!=null) { //this will ensure bootclassloader is used return null; } else { return SecuritySupport.class.getClassLoader(); } }
Example #26
Source File: BagFactory.java From spork with Apache License 2.0 | 5 votes |
/** * Get a reference to the singleton factory. * @return BagFactory */ public static BagFactory getInstance() { if (gSelf == null) { String factoryName = System.getProperty("pig.data.bag.factory.name"); String factoryJar = System.getProperty("pig.data.bag.factory.jar"); if (factoryName != null && factoryJar != null) { try { URL[] urls = new URL[1]; urls[0] = new URL(factoryJar); ClassLoader loader = new URLClassLoader(urls, BagFactory.class.getClassLoader()); Class c = Class.forName(factoryName, true, loader); Object o = c.newInstance(); if (!(o instanceof BagFactory)) { throw new RuntimeException("Provided factory " + factoryName + " does not extend BagFactory!"); } gSelf = (BagFactory)o; } catch (Exception e) { if (e instanceof RuntimeException) { // We just threw this RuntimeException re = (RuntimeException)e; throw re; } throw new RuntimeException("Unable to instantiate " + "bag factory " + factoryName, e); } } else { gSelf = new DefaultBagFactory(); } } return gSelf; }
Example #27
Source File: Parcels.java From parceler with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") public ParcelableFactory findClass(Class clazz, ClassLoader classLoader){ try { Class parcelWrapperClass = classLoader.loadClass(buildParcelableImplName(clazz)); return new ParcelableFactoryReflectionProxy(clazz, parcelWrapperClass); } catch (ClassNotFoundException e) { return null; } }
Example #28
Source File: SecuritySupport.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
static ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); }
Example #29
Source File: SecuritySupport.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
static ClassLoader getContextClassLoader() { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader cl = null; try { cl = Thread.currentThread().getContextClassLoader(); } catch (SecurityException ex) { } return cl; } }); }
Example #30
Source File: SecuritySupport.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
static ClassLoader getParentClassLoader(final ClassLoader cl) { return (ClassLoader) AccessController.doPrivileged(new PrivilegedAction() { public Object run() { ClassLoader parent = null; try { parent = cl.getParent(); } catch (SecurityException ex) { } // eliminate loops in case of the boot // ClassLoader returning itself as a parent return (parent == cl) ? null : parent; } }); }