# Class ClassLoaderRepository

java.lang.Object
org.apache.bcel.util.ClassLoaderRepository

All Implemented Interfaces:
  `Repository`

public class ClassLoaderRepository extends Object implements Repository
The repository maintains information about which classes have been loaded. It loads its data from the ClassLoader implementation passed into its constructor.

See Also:
  - `Repository`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ClassLoaderRepository(ClassLoader loader)`
  Constructs a ClassLoaderRepository.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `clear()`
  Clear all entries from cache.
  `JavaClass`
  `findClass(String className)`
  Find an already defined JavaClass.
  `ClassPath`
  `getClassPath()`
  Gets the ClassPath associated with this Repository.
  `JavaClass`
  `loadClass(Class<?> clazz)`
  Finds the JavaClass instance for the given run-time class object.
  `JavaClass`
  `loadClass(String className)`
  Lookup a JavaClass object from the Class Name provided.
  `void`
  `removeClass(JavaClass clazz)`
  Remove class from repository
  `void`
  `storeClass(JavaClass clazz)`
  Store a new JavaClass into this Repository.

  ### Methods inherited from class Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ClassLoaderRepository

    public ClassLoaderRepository(ClassLoader loader)
    Constructs a ClassLoaderRepository.
    Parameters:
      `loader` - the class loader.

- ## Method Details

  - ### clear

    public void clear()
    Clear all entries from cache.
    Specified by:
      `clear` in interface `Repository`

  - ### findClass

    public JavaClass findClass(String className)
    Find an already defined JavaClass.
    Specified by:
      `findClass` in interface `Repository`
    Parameters:
      `className` - the class name.
    Returns:
      the JavaClass instance, or null.

  - ### getClassPath

    public ClassPath getClassPath()
    Description copied from interface: `Repository`
    Gets the ClassPath associated with this Repository.
    Specified by:
      `getClassPath` in interface `Repository`
    Returns:
      the ClassPath.

  - ### loadClass

    public JavaClass loadClass(Class<?> clazz) throws ClassNotFoundException
    Description copied from interface: `Repository`
    Finds the JavaClass instance for the given run-time class object.
    Specified by:
      `loadClass` in interface `Repository`
    Parameters:
      `clazz` - the class.
    Returns:
      the JavaClass instance.
    Throws:
      `ClassNotFoundException` - if the class can't be found.

  - ### loadClass

    public JavaClass loadClass(String className) throws ClassNotFoundException
    Lookup a JavaClass object from the Class Name provided.
    Specified by:
      `loadClass` in interface `Repository`
    Parameters:
      `className` - the class name.
    Returns:
      the JavaClass instance.
    Throws:
      `ClassNotFoundException` - if the class can't be found.

  - ### removeClass

    public void removeClass(JavaClass clazz)
    Remove class from repository
    Specified by:
      `removeClass` in interface `Repository`
    Parameters:
      `clazz` - the class to remove.

  - ### storeClass

    public void storeClass(JavaClass clazz)
    Store a new JavaClass into this Repository.
    Specified by:
      `storeClass` in interface `Repository`
    Parameters:
      `clazz` - the class to store.