Package proguard.classfile
Class ClassPool
java.lang.Object
proguard.classfile.ClassPool
This is a set of
Clazz instances. They can be enumerated or retrieved by name. They can
also be accessed by means of class visitors.-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new empty ClassPool.Creates a new ClassPool with the given classes.Creates a new ClassPool with the given classes.Creates a new ClassPool with the given classes. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(ClassPoolVisitor classPoolVisitor) Applies the given ClassPoolVisitor to the class pool.voidAdds the given Clazz with the given name to the class pool.voidAdds the given Clazz to the class pool.voidclassAccept(String className, ClassVisitor classVisitor) Applies the given ClassVisitor to the class with the given name, if it is present in the class pool.classes()Returns an Iterable of all classes in the class pool.voidclassesAccept(String classNameFilter, ClassVisitor classVisitor) Applies the given ClassVisitor to all matching classes in the class pool.voidclassesAccept(List<String> classNameFilter, ClassVisitor classVisitor) Applies the given ClassVisitor to all matching classes in the class pool.voidclassesAccept(ClassVisitor classVisitor) Applies the given ClassVisitor to all classes in the class pool, in random order.voidclassesAccept(StringMatcher classNameFilter, ClassVisitor classVisitor) Applies the given ClassVisitor to all matching classes in the class pool.voidclassesAcceptAlphabetically(ClassVisitor classVisitor) Applies the given ClassVisitor to all classes in the class pool, in sorted order.Returns an Iterator of all class names in the class pool.voidclear()Clears the class pool.booleanChecks whether the given class exists in the class pool.Returns a Clazz from the class pool based on its name.Returns a ClassPool with the same classes, but with the keys that correspond to the names of the class instances.refreshedKeysCopy(Map<String, T> map) Returns a Map with the same contents as the given map, but with keys that have been mapped based from the names in the class pool to the names in the corresponding classes.refreshedValuesCopy(Map<T, String> map) Returns a Map with the same contents as the given map, but with values that have been mapped based from the names in the class pool to the names in the corresponding classes.removeClass(String className) Removes the Class with the specified name from the class pool.voidremoveClass(Clazz clazz) Removes the given Clazz from the class pool.Returns a Map that represents a mapping from every Clazz in the ClassPool to its original name.intsize()Returns the number of classes in the class pool.
-
Constructor Details
-
ClassPool
public ClassPool()Creates a new empty ClassPool. -
ClassPool
Creates a new ClassPool with the given classes.- Parameters:
classes- the classes to be added.
-
ClassPool
Creates a new ClassPool with the given classes.- Parameters:
classes- the classes to be added.
-
ClassPool
Creates a new ClassPool with the given classes. The keys are taken from the Clazz instances.- Parameters:
classPool- the classes to be added.
-
-
Method Details
-
clear
public void clear()Clears the class pool. -
addClass
Adds the given Clazz to the class pool. -
addClass
Adds the given Clazz with the given name to the class pool. -
removeClass
Removes the given Clazz from the class pool. -
removeClass
Removes the Class with the specified name from the class pool. -
getClass
Returns a Clazz from the class pool based on its name. Returnsnullif the class with the given name is not in the class pool.- Parameters:
className- a class name (e.g., "java/lang/String").- Returns:
- the corresponding
Clazz.nullif the class pool does not contain a class with the specified name.
-
contains
Checks whether the given class exists in the class pool. -
classNames
Returns an Iterator of all class names in the class pool. -
classes
Returns an Iterable of all classes in the class pool. -
size
public int size()Returns the number of classes in the class pool. -
refreshedCopy
Returns a ClassPool with the same classes, but with the keys that correspond to the names of the class instances. This can be useful to create a class pool with obfuscated names. -
refreshedKeysCopy
Returns a Map with the same contents as the given map, but with keys that have been mapped based from the names in the class pool to the names in the corresponding classes. This can be useful to create a map with obfuscated names as keys. -
refreshedValuesCopy
Returns a Map with the same contents as the given map, but with values that have been mapped based from the names in the class pool to the names in the corresponding classes. This can be useful to create a map with obfuscated names as values. -
reverseMapping
Returns a Map that represents a mapping from every Clazz in the ClassPool to its original name. This can be useful to retrieve the original name of classes after name obfuscation has been applied. -
accept
Applies the given ClassPoolVisitor to the class pool. -
classesAccept
Applies the given ClassVisitor to all classes in the class pool, in random order. -
classesAcceptAlphabetically
Applies the given ClassVisitor to all classes in the class pool, in sorted order. -
classesAccept
Applies the given ClassVisitor to all matching classes in the class pool. -
classesAccept
Applies the given ClassVisitor to all matching classes in the class pool. -
classesAccept
Applies the given ClassVisitor to all matching classes in the class pool. -
classAccept
Applies the given ClassVisitor to the class with the given name, if it is present in the class pool.
-