Class AntClassLoader5
java.lang.Object
java.lang.ClassLoader
org.apache.tools.ant.AntClassLoader
org.apache.tools.ant.loader.AntClassLoader5
- All Implemented Interfaces:
Closeable, AutoCloseable, EventListener, BuildListener, SubBuildListener
Deprecated.
-
Constructor Summary
ConstructorsConstructorDescriptionAntClassLoader5(ClassLoader parent, Project project, Path classpath, boolean parentFirst) Deprecated.Creates a classloader for the given project using the classpath given. -
Method Summary
Methods inherited from class AntClassLoader
addJavaLibraries, addLoaderPackageRoot, addPathComponent, addPathElement, addPathFile, addSystemPackageRoot, buildFinished, buildStarted, cleanup, close, defineClassFromData, definePackage, definePackage, findClass, findResource, findResources, findResources, forceLoadClass, forceLoadSystemClass, getClasspath, getConfiguredParent, getNamedResources, getResource, getResourceAsStream, getResources, getResourceURL, initializeClass, isInPath, loadClass, log, messageLogged, newAntClassLoader, resetThreadContextLoader, setClassPath, setIsolated, setParent, setParentFirst, setProject, setThreadContextLoader, subBuildFinished, subBuildStarted, targetFinished, targetStarted, taskFinished, taskStarted, toStringModifier and TypeMethodDescriptionvoidadd any libraries that come with different java versions herevoidaddLoaderPackageRoot(String packageRoot) Adds a package root to the list of packages which must be loaded using this loader.voidaddPathComponent(File file) Add a path component.voidaddPathElement(String pathElement) Adds an element to the classpath to be searched.protected voidaddPathFile(File pathComponent) Add a file to the path.voidaddSystemPackageRoot(String packageRoot) Adds a package root to the list of packages which must be loaded on the parent loader.voidbuildFinished(BuildEvent event) Cleans up any resources held by this classloader at the end of a build.voidbuildStarted(BuildEvent event) Empty implementation to satisfy the BuildListener interface.voidcleanup()Cleans up any resources held by this classloader.voidclose()protected Class<?> defineClassFromData(File container, byte[] classData, String classname) Define a class given its bytesprotected voiddefinePackage(File container, String className) Define the package information associated with a class.protected voiddefinePackage(File container, String packageName, Manifest manifest) Define the package information when the class comes from a jar with a manifestClass<?> Searches for and load a class on the classpath of this class loader.protected URLfindResource(String name) Finds the resource with the given name.protected Enumeration<URL> findResources(String name) Returns an enumeration of URLs representing all the resources with the given name by searching the class loader's classpath.protected Enumeration<URL> findResources(String name, boolean skipParent) Returns an enumeration of URLs representing all the resources with the given name by searching the class loader's classpath.Class<?> forceLoadClass(String classname) Loads a class through this class loader even if that class is available on the parent classpath.Class<?> forceLoadSystemClass(String classname) Loads a class through this class loader but defer to the parent class loader.Returns the classpath this classloader will consult.Gets the parent as has been specified in the constructor or via setParent.getNamedResources(String name) Finds all the resources with the given name.getResource(String name) Finds the resource with the given name.getResourceAsStream(String name) Returns a stream to read the requested resource name.getResources(String name) protected URLgetResourceURL(File file, String resourceName) Returns the URL of a given resource in the given file which may either be a directory or a zip file.static voidinitializeClass(Class<?> theClass) Deprecated.since 1.6.x.protected booleanIndicate if the given file is in this loader's pathprotected Class<?> Loads a class with this class loader.protected voidLogs a message through the project object if one has been provided.voidmessageLogged(BuildEvent event) Empty implementation to satisfy the BuildListener interface.static AntClassLoadernewAntClassLoader(ClassLoader parent, Project project, Path path, boolean parentFirst) Factory methodvoidResets the current thread's context loader to its original value.voidsetClassPath(Path classpath) Set the classpath to search for classes to load.voidsetIsolated(boolean isolated) Sets whether this classloader should run in isolated mode.voidsetParent(ClassLoader parent) Set the parent for this class loader.voidsetParentFirst(boolean parentFirst) Control whether class lookup is delegated to the parent loader first or after this loader.voidsetProject(Project project) Set the project associated with this class loadervoidSets the current thread's context loader to this classloader, storing the current loader value for later resetting.voidsubBuildFinished(BuildEvent event) Cleans up any resources held by this classloader at the end of a subbuild if it has been created for the subbuild's project instance.voidsubBuildStarted(BuildEvent event) Empty implementation to satisfy the BuildListener interface.voidtargetFinished(BuildEvent event) Empty implementation to satisfy the BuildListener interface.voidtargetStarted(BuildEvent event) Empty implementation to satisfy the BuildListener interface.voidtaskFinished(BuildEvent event) Empty implementation to satisfy the BuildListener interface.voidtaskStarted(BuildEvent event) Empty implementation to satisfy the BuildListener interface.toString()Returns aStringrepresenting this loader.Methods inherited from class ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findLibrary, findLoadedClass, findResource, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Constructor Details
-
AntClassLoader5
Deprecated.Creates a classloader for the given project using the classpath given.- Parameters:
parent- The parent classloader to which unsatisfied loading attempts are delegated. May benull, in which case the classloader which loaded this class is used as the parent.project- The project to which this classloader is to belong. Must not benull.classpath- the classpath to use to load the classes. May benull, in which case no path elements are set up to start with.parentFirst- Iftrue, indicates that the parent classloader should be consulted before trying to load the a class through this loader.
-
AntClassLoaderitself.