com.opensymphony.xwork2.util.finder.ClassLoaderInterfaceDelegate Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xwork Show documentation
Show all versions of xwork Show documentation
XWork is an command-pattern framework that is used to power WebWork
as well as other applications. XWork provides an Inversion of Control
container, a powerful expression language, data type conversion,
validation, and pluggable configuration.
The newest version!
/*
* Copyright (c) 2002-2003 by OpenSymphony
* All rights reserved.
*/
package com.opensymphony.xwork2.util.finder;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Enumeration;
/**
* Default implementation of ClassLoaderInterface, which delegates to an actual ClassLoader
*/
public class ClassLoaderInterfaceDelegate implements ClassLoaderInterface {
private ClassLoader classLoader;
public ClassLoaderInterfaceDelegate(ClassLoader classLoader) {
this.classLoader = classLoader;
}
public Class> loadClass(String name) throws ClassNotFoundException {
return classLoader.loadClass(name);
}
public URL getResource(String className) {
return classLoader.getResource(className);
}
public Enumeration getResources(String name) throws IOException {
return classLoader.getResources(name);
}
public InputStream getResourceAsStream(String name) {
return getResourceAsStream(name);
}
public ClassLoaderInterface getParent() {
return classLoader.getParent() != null ? new ClassLoaderInterfaceDelegate(classLoader.getParent()) : null;
}
}