Package org.apache.bcel.util
Class MemorySensitiveClassPathRepository
- java.lang.Object
-
- org.apache.bcel.util.AbstractClassPathRepository
-
- org.apache.bcel.util.MemorySensitiveClassPathRepository
-
- All Implemented Interfaces:
Repository
- Direct Known Subclasses:
SyntheticRepository
public class MemorySensitiveClassPathRepository extends AbstractClassPathRepository
This repository is used in situations where a Class is created outside the realm of a ClassLoader. Classes are loaded from the file systems using the paths specified in the given class path. By default, this is the value returned by ClassPath.getClassPath(). This repository holds onto classes with SoftReferences, and will reload as needed, in cases where memory sizes are important.- See Also:
Repository
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.Map<java.lang.String,java.lang.ref.SoftReference<JavaClass>>
_loadedClasses
-
Constructor Summary
Constructors Constructor Description MemorySensitiveClassPathRepository(ClassPath path)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clear()
Clear all entries from cache.JavaClass
findClass(java.lang.String className)
Find an already defined (cached) JavaClass object by name.void
removeClass(JavaClass clazz)
Remove class from repositoryvoid
storeClass(JavaClass clazz)
Store a new JavaClass instance into this Repository.-
Methods inherited from class org.apache.bcel.util.AbstractClassPathRepository
getClassPath, loadClass, loadClass
-
-
-
-
Field Detail
-
_loadedClasses
private final java.util.Map<java.lang.String,java.lang.ref.SoftReference<JavaClass>> _loadedClasses
-
-
Constructor Detail
-
MemorySensitiveClassPathRepository
public MemorySensitiveClassPathRepository(ClassPath path)
-
-
Method Detail
-
storeClass
public void storeClass(JavaClass clazz)
Store a new JavaClass instance into this Repository.- Specified by:
storeClass
in interfaceRepository
- Specified by:
storeClass
in classAbstractClassPathRepository
-
removeClass
public void removeClass(JavaClass clazz)
Remove class from repository- Specified by:
removeClass
in interfaceRepository
- Specified by:
removeClass
in classAbstractClassPathRepository
-
findClass
public JavaClass findClass(java.lang.String className)
Find an already defined (cached) JavaClass object by name.- Specified by:
findClass
in interfaceRepository
- Specified by:
findClass
in classAbstractClassPathRepository
-
clear
public void clear()
Clear all entries from cache.- Specified by:
clear
in interfaceRepository
- Specified by:
clear
in classAbstractClassPathRepository
-
-