Package net.sf.cglib.core
Class AbstractClassGenerator.ClassLoaderData
java.lang.Object
net.sf.cglib.core.AbstractClassGenerator.ClassLoaderData
- Enclosing class:
- AbstractClassGenerator<T>
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final WeakReference<ClassLoader>
Note: ClassLoaderData object is stored as a value ofWeakHashMap<ClassLoader, ...>
thus this classLoader reference should be weak otherwise it would make classLoader strongly reachable and alive forever.private final LoadingCache<AbstractClassGenerator,
Object, Object> AbstractClassGenerator
here holds "cache key" (e.g.private static final Function<AbstractClassGenerator,
Object> private final Predicate
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionget
(AbstractClassGenerator gen, boolean useCache) void
reserveName
(String name)
-
Field Details
-
reservedClassNames
-
generatedClasses
AbstractClassGenerator
here holds "cache key" (e.g.Enhancer
configuration), and the value is the generated class plus some additional values (seeAbstractClassGenerator.unwrapCachedValue(Object)
.The generated classes can be reused as long as their classloader is reachable.
Note: the only way to access a class is to find it through generatedClasses cache, thus the key should not expire as long as the class itself is alive (its classloader is alive).
-
classLoader
Note: ClassLoaderData object is stored as a value ofWeakHashMap<ClassLoader, ...>
thus this classLoader reference should be weak otherwise it would make classLoader strongly reachable and alive forever. Reference queue is not required since the cleanup is handled byWeakHashMap
. -
uniqueNamePredicate
-
GET_KEY
-
-
Constructor Details
-
ClassLoaderData
-
-
Method Details
-
getClassLoader
-
reserveName
-
getUniqueNamePredicate
-
get
-