Top Description Fields Constructors Methods
org.apache.bcel.util

pack-priv abstract Class AbstractClassPathRepository

extends Object
implements Repository
Class Inheritance
All Implemented Interfaces
org.apache.bcel.util.Repository
Known Direct Subclasses
org.apache.bcel.util.ClassPathRepository, org.apache.bcel.util.LruCacheClassPathRepository, org.apache.bcel.util.MemorySensitiveClassPathRepository
Imports
java.io.IOException, .InputStream, org.apache.bcel.classfile.ClassParser, .JavaClass, .Utility

This abstract class provides a logic of a loading JavaClass objects class names via ClassPath.

Subclasses can choose caching strategy of the objects by implementing the abstract methods (e.g., storeClass(JavaClass) and findClass(String)).

Since
6.4.0

Field Summary

Modifier and TypeField and Description
private final ClassPath

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public abstract void
clear()

Redeclares org.apache.bcel.util.Repository.clear.

Clears all entries from cache.
public abstract JavaClass
findClass(final String className)

Redeclares org.apache.bcel.util.Repository.findClass.

Finds the class with the name provided, if the class isn't there, return NULL.
public ClassPath
getClassPath()

Implements org.apache.bcel.util.Repository.getClassPath.

Gets the ClassPath associated with this Repository
public JavaClass

Returns:

JavaClass object for given runtime class
loadClass
(final Class<?>
the runtime Class object
clazz
)

Implements org.apache.bcel.util.Repository.loadClass.

Finds the JavaClass object for a runtime Class object.
private JavaClass
loadClass(final InputStream inputStream, final String className)

public JavaClass

Returns:

the JavaClass object
loadClass
(String
the name of the class
className
)

Implements org.apache.bcel.util.Repository.loadClass.

Finds a JavaClass object by name.
public abstract void
removeClass(final JavaClass javaClass)

Redeclares org.apache.bcel.util.Repository.removeClass.

Removes class from repository
public abstract void
storeClass(final JavaClass javaClass)

Redeclares org.apache.bcel.util.Repository.storeClass.

Stores the provided class under "clazz.getClassName()"
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

classPathback to summary
private final ClassPath classPath

Constructor Detail

AbstractClassPathRepositoryback to summary
pack-priv AbstractClassPathRepository(final ClassPath classPath)

Method Detail

clearback to summary
public abstract void clear()

Redeclares org.apache.bcel.util.Repository.clear.

Doc from org.apache.bcel.util.Repository.clear.

Clears all entries from cache.

Annotations
@Override
findClassback to summary
public abstract JavaClass findClass(final String className)

Redeclares org.apache.bcel.util.Repository.findClass.

Doc from org.apache.bcel.util.Repository.findClass.

Finds the class with the name provided, if the class isn't there, return NULL.

Annotations
@Override
getClassPathback to summary
public ClassPath getClassPath()

Implements org.apache.bcel.util.Repository.getClassPath.

Doc from org.apache.bcel.util.Repository.getClassPath.

Gets the ClassPath associated with this Repository

Annotations
@Override
loadClassback to summary
public JavaClass loadClass(final Class<?> clazz) throws ClassNotFoundException

Implements org.apache.bcel.util.Repository.loadClass.

Finds the JavaClass object for a runtime Class object. If a class with the same name is already in this Repository, the Repository version is returned. Otherwise, getResourceAsStream() is called on the Class object to find the class's representation. If the representation is found, it is added to the Repository.

Parameters
clazz:Class<?>

the runtime Class object

Returns:JavaClass

JavaClass object for given runtime class

Annotations
@Override
Exceptions
ClassNotFoundException:
if the class is not in the Repository, and its representation could not be found
See Also
Class
loadClassback to summary
private JavaClass loadClass(final InputStream inputStream, final String className) throws ClassNotFoundException
loadClassback to summary
public JavaClass loadClass(String className) throws ClassNotFoundException

Implements org.apache.bcel.util.Repository.loadClass.

Finds a JavaClass object by name. If it is already in this Repository, the Repository version is returned. Otherwise, the Repository's classpath is searched for the class (and it is added to the Repository if found).

Parameters
className:String

the name of the class

Returns:JavaClass

the JavaClass object

Annotations
@Override
Exceptions
ClassNotFoundException:
if the class is not in the Repository, and could not be found on the classpath
removeClassback to summary
public abstract void removeClass(final JavaClass javaClass)

Redeclares org.apache.bcel.util.Repository.removeClass.

Doc from org.apache.bcel.util.Repository.removeClass.

Removes class from repository

Annotations
@Override
storeClassback to summary
public abstract void storeClass(final JavaClass javaClass)

Redeclares org.apache.bcel.util.Repository.storeClass.

Doc from org.apache.bcel.util.Repository.storeClass.

Stores the provided class under "clazz.getClassName()"

Annotations
@Override