本文整理了Java中org.restlet.engine.Engine.getClassLoader()
方法的一些代码示例,展示了Engine.getClassLoader()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Engine.getClassLoader()
方法的具体详情如下:
包路径:org.restlet.engine.Engine
类名称:Engine
方法名:getClassLoader
[英]Returns the class loader. It uses the delegation model with the Engine class's class loader as a parent. If this parent doesn't find a class or resource, it then tries the user class loader (via #getUserClassLoader() and finally the Thread#getContextClassLoader().
[中]返回类加载器。它使用委托模型,将引擎类的类装入器作为父类。如果此父级找不到类或资源,则会尝试用户类加载器(通过#getUserClassLoader()和线程#getContextClassLoader()。
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the class object for the given name using the engine classloader.
*
* @param className
* The class name to lookup.
* @return The class object or null if the class was not found.
* @see #getClassLoader()
*/
public static Class<?> loadClass(String className)
throws ClassNotFoundException {
return getInstance().getClassLoader().loadClass(className);
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Returns the classloader resource for a given name/path.
*
* @param name
* The name/path to lookup.
* @return The resource URL.
*/
public static java.net.URL getResource(String name) {
return getInstance().getClassLoader().getResource(name);
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Registers a list of helpers.
*
* @param descriptorPath
* Classpath to the descriptor file.
* @param helpers
* The list of helpers to update.
* @param constructorClass
* The constructor parameter class to look for.
* @throws IOException
*/
public void registerHelpers(String descriptorPath, List<?> helpers,
Class<?> constructorClass) throws IOException {
ClassLoader classLoader = getClassLoader();
Enumeration<java.net.URL> configUrls = classLoader
.getResources(descriptorPath);
if (configUrls != null) {
for (Enumeration<java.net.URL> configEnum = configUrls; configEnum
.hasMoreElements();) {
registerHelpers(classLoader, configEnum.nextElement(), helpers,
constructorClass);
}
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet
/**
* Wraps the client resource to proxy calls to the given Java interface into
* Restlet method calls. Use the {@link org.restlet.engine.Engine}
* classloader in order to generate the proxy.
*
* @param <T>
* @param resourceInterface
* The annotated resource interface class to proxy.
* @return The proxy instance.
*/
public <T> T wrap(Class<? extends T> resourceInterface) {
return wrap(resourceInterface, org.restlet.engine.Engine.getInstance()
.getClassLoader());
}
代码示例来源:origin: org.restlet.jee/org.restlet.ext.jaxrs
/**
* Wraps the client resource to proxy calls to the given Java interface into
* Restlet method calls.
*
* @param <T>
* @param resourceInterface
* The annotated resource interface class to proxy.
* @return The proxy instance.
*/
@SuppressWarnings("unchecked")
public <T> T wrap(Class<? extends T> resourceInterface) {
T result = null;
// Create the client resource proxy
java.lang.reflect.InvocationHandler h = new org.restlet.ext.jaxrs.internal.client.JaxRsClientInvocationHandler<T>(
this, resourceInterface);
// Instantiate our dynamic proxy
result = (T) java.lang.reflect.Proxy.newProxyInstance(
org.restlet.engine.Engine.getInstance().getClassLoader(),
new Class<?>[] { ClientProxy.class, resourceInterface }, h);
return result;
}
}
代码示例来源:origin: org.restlet.osgi/org.restlet
"org.restlet.engine.log.LoggerFacade");
try {
this.loggerFacade = (LoggerFacade) getClassLoader().loadClass(
loggerFacadeClass).newInstance();
} catch (Exception e) {
内容来源于网络,如有侵权,请联系作者删除!