org.apache.commons.classscan.builtin
Class UrlMetaClassLoader

java.lang.Object
  extended by org.apache.commons.classscan.builtin.UrlMetaClassLoader
All Implemented Interfaces:
MetaClassLoader, SpiMetaClassLoader
Direct Known Subclasses:
BootstrapMetaClassLoader

public class UrlMetaClassLoader
extends Object
implements SpiMetaClassLoader


Constructor Summary
UrlMetaClassLoader(SpiMetaRegistry registry, ClassLoader classLoader)
           
 
Method Summary
protected  void addLocation(SpiMetaClassPathElement cpe)
           
 Collection<? extends MetaClass> findAllImplementors(String interfaceToFind)
          Find all the implementors of an interface class.
 MetaClass findMetaClass(String className)
          Find metadata about a particular Class.
 MetaClassPathElement getClassLocation(String location)
          Get metadata about a class locations
 Collection<? extends MetaClassPathElement> getClassLocations()
          Get metadata about the locations from which the associated ClassLoader loads Classes.
 MetaClass getMetaClass(String className)
          Get metadata about a particular Class.
 Iterator<? extends MetaClass> getMetaClasses()
          Get metadata about the Classes from which the associated ClassLoader can load.
 MetaClassLoader getParent()
          Get the metadata about the parent of the associated ClassLoader.
 MetaClass resolveMetaClass(String className)
           
 MetaType resolveTypeForDescriptor(String fieldDescriptor)
          Get metadata representing a type from its byte code signature
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UrlMetaClassLoader

public UrlMetaClassLoader(SpiMetaRegistry registry,
                          ClassLoader classLoader)
Method Detail

addLocation

protected void addLocation(SpiMetaClassPathElement cpe)

getParent

public MetaClassLoader getParent()
Description copied from interface: MetaClassLoader
Get the metadata about the parent of the associated ClassLoader.

Specified by:
getParent in interface MetaClassLoader
Returns:
The parent metadata. This will be null if the associated ClassLoader is the primordial ClassLoader.

getClassLocations

public Collection<? extends MetaClassPathElement> getClassLocations()
Description copied from interface: MetaClassLoader
Get metadata about the locations from which the associated ClassLoader loads Classes.

Specified by:
getClassLocations in interface MetaClassLoader
Returns:
A read-only set of code locations

getClassLocation

public MetaClassPathElement getClassLocation(String location)
Description copied from interface: MetaClassLoader
Get metadata about a class locations

Specified by:
getClassLocation in interface MetaClassLoader
Parameters:
location - The location of a folder, jar, or compressed code

getMetaClasses

public Iterator<? extends MetaClass> getMetaClasses()
Description copied from interface: MetaClassLoader
Get metadata about the Classes from which the associated ClassLoader can load.

Specified by:
getMetaClasses in interface MetaClassLoader
Returns:
A read-only set of class information

getMetaClass

public MetaClass getMetaClass(String className)
Description copied from interface: MetaClassLoader
Get metadata about a particular Class. This method will return only classes defined by the associated ClassLoader. Classes defined by a parent ClassLoader can be found using MetaClassLoader.findMetaClass(java.lang.String).

Specified by:
getMetaClass in interface MetaClassLoader
Parameters:
className - The name of the Class
Returns:
The metadata about the Class; or null, if the class was not available to the associated ClassLoader

findMetaClass

public MetaClass findMetaClass(String className)
Description copied from interface: MetaClassLoader
Find metadata about a particular Class. This method will first search up the associated parent ClassLoader chain.

Specified by:
findMetaClass in interface MetaClassLoader
Parameters:
className - The name of the Class
Returns:
The metadata about the Class; or null, if the class was not available to the associated ClassLoader not its parent chain

resolveMetaClass

public MetaClass resolveMetaClass(String className)
Specified by:
resolveMetaClass in interface SpiMetaClassLoader

resolveTypeForDescriptor

public MetaType resolveTypeForDescriptor(String fieldDescriptor)
Get metadata representing a type from its byte code signature

Specified by:
resolveTypeForDescriptor in interface SpiMetaClassLoader
Parameters:
fieldDescriptor - The field descriptor as defined in section 4.3.2 of The Java Virtual Machine Specification
Returns:
The type metadata

findAllImplementors

public Collection<? extends MetaClass> findAllImplementors(String interfaceToFind)
Description copied from interface: MetaClassLoader
Find all the implementors of an interface class. This method will search in the associated ClassLoader and all parents.

Specified by:
findAllImplementors in interface MetaClassLoader
Parameters:
interfaceToFind - The non-null MetaClass associated with the
Returns:
All discovered implementors of the desired interface


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.