Package org.apache.tools.ant.util
Class LoaderUtils
- java.lang.Object
- 
- org.apache.tools.ant.util.LoaderUtils
 
- 
 public class LoaderUtils extends java.lang.ObjectClassLoader utility methods
- 
- 
Constructor SummaryConstructors Constructor Description LoaderUtils()
 - 
Method SummaryModifier and Type Method Description static booleanclassExists(java.lang.ClassLoader loader, java.lang.String className)Check if a classloader has a classname resource.static java.lang.StringclassNameToResource(java.lang.String className)Return the resource name of a class name.static java.io.FilegetClassSource(java.lang.Class<?> c)Find the directory or jar file the class has been loaded from.static java.lang.ClassLoadergetContextClassLoader()JDK1.1 compatible access to set the context class loader.static java.io.FilegetResourceSource(java.lang.ClassLoader c, java.lang.String resource)Find the directory or a give resource has been loaded from.static booleanisContextLoaderAvailable()Indicates if the context class loader methods are availablestatic voidsetContextClassLoader(java.lang.ClassLoader loader)Set the context classloader
 
- 
- 
- 
Method Detail- 
setContextClassLoaderpublic static void setContextClassLoader(java.lang.ClassLoader loader) Set the context classloader- Parameters:
- loader- the ClassLoader to be used as the context class loader on the current thread.
 
 - 
getContextClassLoaderpublic static java.lang.ClassLoader getContextClassLoader() JDK1.1 compatible access to set the context class loader.- Returns:
- the ClassLoader instance being used as the context classloader on the current thread. Returns null on JDK 1.1
 
 - 
isContextLoaderAvailablepublic static boolean isContextLoaderAvailable() Indicates if the context class loader methods are available- Returns:
- true if the get and set methods dealing with the context classloader are available.
 
 - 
getClassSourcepublic static java.io.File getClassSource(java.lang.Class<?> c) Find the directory or jar file the class has been loaded from.- Parameters:
- c- the class whose location is required.
- Returns:
- the file or jar with the class or null if we cannot determine the location.
- Since:
- Ant 1.6
 
 - 
getResourceSourcepublic static java.io.File getResourceSource(java.lang.ClassLoader c, java.lang.String resource)Find the directory or a give resource has been loaded from.- Parameters:
- c- the classloader to be consulted for the source
- resource- the resource whose location is required.
- Returns:
- the file with the resource source or null if we cannot determine the location.
- Since:
- Ant 1.6
 
 - 
classNameToResourcepublic static java.lang.String classNameToResource(java.lang.String className) Return the resource name of a class name.- Parameters:
- className- the name of the class to convert.
- Returns:
- the corresponding resource name.
- Since:
- Ant 1.7.0.
 
 - 
classExistspublic static boolean classExists(java.lang.ClassLoader loader, java.lang.String className)Check if a classloader has a classname resource.- Parameters:
- loader- the classloader to look it.
- className- the name of the class to look for.
- Returns:
- true if the class exists, false otherwise
- Since:
- Ant 1.7.0.
 
 
- 
 
-