A container of
CtClass objects. A
CtClass object must be obtained from this object. If
get() is called on this object, it searches various sources represented by
ClassPath to find a class file and then it creates a
CtClass object representing that class file. The created object is returned to the caller.
Memory consumption memo:
ClassPool objects hold all the CtClasses that have been created so that the consistency among modified classes can be guaranteed. Thus if a large number of CtClasses are processed, the ClassPool will consume a huge amount of memory. To avoid this, a ClassPool object should be recreated, for example, every hundred classes processed. Note that getDefault() is a singleton factory. Otherwise, detach() in CtClass should be used to avoid huge memory consumption.
ClassPool hierarchy:
ClassPools can make a parent-child hierarchy as java.lang.ClassLoaders. If a ClassPool has a parent pool, get() first asks the parent pool to find a class file. Only if the parent could not find the class file, get() searches the ClassPaths of the child ClassPool. This search order is reversed if ClassPath.childFirstLookup is true.
@see javassist.CtClass
@see javassist.ClassPath