本文整理了Java中java.lang.ClassLoader.findResource()
方法的一些代码示例,展示了ClassLoader.findResource()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ClassLoader.findResource()
方法的具体详情如下:
包路径:java.lang.ClassLoader
类名称:ClassLoader
方法名:findResource
[英]Finds the URL of the resource with the specified name. This implementation just returns null; it should be overridden in subclasses.
[中]查找具有指定名称的资源的URL。这个实现只返回null;它应该在子类中被重写。
代码示例来源:origin: robovm/robovm
/**
* Returns the URL of the resource with the specified name. This
* implementation first tries to use the parent class loader to find the
* resource; if this fails then {@link #findResource(String)} is called to
* find the requested resource.
*
* @param resName
* the name of the resource to find.
* @return the {@code URL} object for the requested resource or {@code null}
* if the resource can not be found
* @see Class#getResource
*/
public URL getResource(String resName) {
URL resource = parent.getResource(resName);
if (resource == null) {
resource = findResource(resName);
}
return resource;
}
代码示例来源:origin: hibernate/hibernate-orm
@Override
protected URL findResource(String name) {
final Iterator<ClassLoader> clIterator = newClassLoaderIterator();
while ( clIterator.hasNext() ) {
final ClassLoader classLoader = clIterator.next();
final URL resource = classLoader.getResource( name );
if ( resource != null ) {
return resource;
}
}
return super.findResource( name );
}
代码示例来源:origin: hibernate/hibernate-orm
@Override
protected URL findResource(String name) {
if ( name.startsWith( "org.hibernate" ) ) {
names.add( name );
}
return super.findResource( name );
}
代码示例来源:origin: com.carecon.fabric3/fabric3-host-api
protected URL findResource(String name) {
if (maskResources){
return null;
}
return super.findResource(name);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-bootstrap
/** This ClassLoader can't load anything itself. Subclasses
* may override this method to do some resource loading themselves.
*
* @param name the resource name
* @return a URL for reading the resource, or <code>null</code>
* if the resource could not be found.
*/
@Override
public URL findResource(String name) {
return super.findResource(name);
}
代码示例来源:origin: hibernate/hibernate-search
@Override
protected URL findResource(String name) {
for ( ClassLoader classLoader : individualClassLoaders ) {
final URL resource = classLoader.getResource( name );
if ( resource != null ) {
return resource;
}
}
return super.findResource( name );
}
代码示例来源:origin: org.jruby/jruby-complete
protected URL findResource(String name) {
for (ClassLoader classLoader : classLoaders) {
URL resource = classLoader.getResource(name);
if (resource != null) {
return resource;
}
}
return super.findResource(name);
}
代码示例来源:origin: org.infinispan/infinispan-commons
@Override
protected URL findResource(String name) {
for (ClassLoader cl : classLoaders) {
URL res = cl.getResource(name);
if (res != null) {
return res;
}
}
return super.findResource(name);
}
代码示例来源:origin: hibernate/hibernate-search
@Override
protected URL findResource(String name) {
for ( ClassLoader classLoader : individualClassLoaders ) {
final URL resource = classLoader.getResource( name );
if ( resource != null ) {
return resource;
}
}
return super.findResource( name );
}
代码示例来源:origin: org.jruby/jruby-core
protected URL findResource(String name) {
for (ClassLoader classLoader : classLoaders) {
URL resource = classLoader.getResource(name);
if (resource != null) {
return resource;
}
}
return super.findResource(name);
}
代码示例来源:origin: org.infinispan/infinispan-embedded-query
@Override
protected URL findResource(String name) {
for ( ClassLoader classLoader : individualClassLoaders ) {
final URL resource = classLoader.getResource( name );
if ( resource != null ) {
return resource;
}
}
return super.findResource( name );
}
代码示例来源:origin: org.hibernate.search/hibernate-search-engine
@Override
protected URL findResource(String name) {
for ( ClassLoader classLoader : individualClassLoaders ) {
final URL resource = classLoader.getResource( name );
if ( resource != null ) {
return resource;
}
}
return super.findResource( name );
}
代码示例来源:origin: org.hibernate.orm/hibernate-core
@Override
protected URL findResource(String name) {
final Iterator<ClassLoader> clIterator = newClassLoaderIterator();
while ( clIterator.hasNext() ) {
final ClassLoader classLoader = clIterator.next();
final URL resource = classLoader.getResource( name );
if ( resource != null ) {
return resource;
}
}
return super.findResource( name );
}
代码示例来源:origin: co.cask.tigon/tigon-yarn
@Override
public URL findResource(String name) {
if (isValidResource(name)) {
return super.findResource(name);
}
return null;
}
代码示例来源:origin: kiegroup/droolsjbpm-integration
@Implementation
@Override
protected URL findResource(String name) {
return super.findResource(name);
}
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-nbjunit
@Override
public URL findResource(String name) {
if (isUnit(name)) {
return junit.getResource(name);
}
if (name.equals("META-INF/services/java.util.logging.Handler")) { // NOI18N
return junit.getResource("org/netbeans/junit/internal/FakeMetaInf.txt"); // NOI18N
}
return super.findResource(name);
}
代码示例来源:origin: org.kantega.reststop/reststop-classloader-utils
@Override
public URL getResource(String name) {
if (isLocalResource(name)) {
return super.findResource(name);
} else {
return super.getResource(name);
}
}
代码示例来源:origin: org.kantega.openaksess/openaksess-core
@Override
public URL getResource(String name) {
if (isLocalResource(name)) {
return super.findResource(name);
} else {
return super.getResource(name);
}
}
代码示例来源:origin: org.apache.ranger/lookup-client
@Override
protected URL findResource(String resourceName) {
LOG.debug("findResource(" + resourceName + ") is called.") ;
URL ret = null;
if (confHolder.hasResourceExists(resourceName)) {
ret = buildResourceFile(resourceName) ;
}
else {
ret = super.findResource(resourceName);
}
LOG.debug("findResource(" + resourceName + ") is returning [" + ret + "]") ;
return ret ;
}
代码示例来源:origin: org.apache.tomee/arquillian-openejb-embedded
@Override
protected URL findResource(final String name) {
final LinkedList<Archive<?>> node = findNodes(name);
if (!node.isEmpty()) {
final Archive<?> i = node.getLast();
try {
return new URL(null, "archive:" + i.getName() + (!name.startsWith("/") ? "/" : "") + name, new ArchiveStreamHandler());
} catch (final MalformedURLException e) {
throw new IllegalArgumentException(e);
}
}
return super.findResource(name);
}
内容来源于网络,如有侵权,请联系作者删除!