ProGuard

proguard.classfile
Class ClassPool

java.lang.Object
  extended byproguard.classfile.ClassPool

public class ClassPool
extends Object

This is a set of representations of class files. They can be enumerated or retrieved by name. They can also be accessed by means of class file visitors.


Constructor Summary
ClassPool()
           
 
Method Summary
 void accept(ClassPoolVisitor classPoolVisitor)
          Applies the given ClassPoolVisitor to the class pool.
 ClassFile addClass(ClassFile classFile)
          Adds the given ClassFile to the class pool.
 void classFileAccept(ClassFileVisitor classFileVisitor, String className)
          Applies the given ClassFileVisitor to the class with the given name, if it is present in the class pool.
 void classFilesAccept(ClassFileVisitor classFileVisitor)
          Applies the given ClassFileVisitor to all classes in the class pool, in random order.
 void classFilesAcceptAlphabetically(ClassFileVisitor classFileVisitor)
          Applies the given ClassFileVisitor to all classes in the class pool, in sorted order.
 Iterator elements()
          Returns an Iterator of all ClassFile objects in the class pool.
 ClassFile getClass(String className)
          Returns a ClassFile from the class pool based on its name.
 void removeClass(ClassFile classFile)
          Removes the given ClassFile from the class pool.
 int size()
          Returns the number of class files in the class pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClassPool

public ClassPool()
Method Detail

addClass

public ClassFile addClass(ClassFile classFile)
Adds the given ClassFile to the class pool. If a class file of the same name is already present, it is left unchanged and the old class file is returned.


removeClass

public void removeClass(ClassFile classFile)
Removes the given ClassFile from the class pool.


getClass

public ClassFile getClass(String className)
Returns a ClassFile from the class pool based on its name. Returns null if the class with the given name is not in the class pool. Returns the base class if the class name is an array type, and the java.lang.Object class if that base class is a primitive type.


elements

public Iterator elements()
Returns an Iterator of all ClassFile objects in the class pool.


size

public int size()
Returns the number of class files in the class pool.


accept

public void accept(ClassPoolVisitor classPoolVisitor)
Applies the given ClassPoolVisitor to the class pool.


classFilesAccept

public void classFilesAccept(ClassFileVisitor classFileVisitor)
Applies the given ClassFileVisitor to all classes in the class pool, in random order.


classFilesAcceptAlphabetically

public void classFilesAcceptAlphabetically(ClassFileVisitor classFileVisitor)
Applies the given ClassFileVisitor to all classes in the class pool, in sorted order.


classFileAccept

public void classFileAccept(ClassFileVisitor classFileVisitor,
                            String className)
Applies the given ClassFileVisitor to the class with the given name, if it is present in the class pool.


ProGuard