proguard.classfile.editor
Class ConstantAdder

java.lang.Object
  extended by proguard.classfile.editor.ConstantAdder
All Implemented Interfaces:
ConstantVisitor

public class ConstantAdder
extends java.lang.Object
implements ConstantVisitor

This ConstantVisitor adds all constants that it visits to the constant pool of a given target class.


Constructor Summary
ConstantAdder()
           
 
Method Summary
 int getConstantIndex()
          Returns the index of the most recently created constant in the constant pool of the target class.
 ProgramClass getTargetClass()
          Returns the class to which visited constants will be copied.
 void setTargetClass(ProgramClass targetClass)
          Sets the class to which visited constants will be copied.
 void visitClassConstant(Clazz clazz, ClassConstant classConstant)
           
 void visitDoubleConstant(Clazz clazz, DoubleConstant doubleConstant)
           
 void visitFieldrefConstant(Clazz clazz, FieldrefConstant fieldrefConstant)
           
 void visitFloatConstant(Clazz clazz, FloatConstant floatConstant)
           
 void visitIntegerConstant(Clazz clazz, IntegerConstant integerConstant)
           
 void visitInterfaceMethodrefConstant(Clazz clazz, InterfaceMethodrefConstant interfaceMethodrefConstant)
           
 void visitLongConstant(Clazz clazz, LongConstant longConstant)
           
 void visitMethodrefConstant(Clazz clazz, MethodrefConstant methodrefConstant)
           
 void visitNameAndTypeConstant(Clazz clazz, NameAndTypeConstant nameAndTypeConstant)
           
 void visitStringConstant(Clazz clazz, StringConstant stringConstant)
           
 void visitUtf8Constant(Clazz clazz, Utf8Constant utf8Constant)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstantAdder

public ConstantAdder()
Method Detail

setTargetClass

public void setTargetClass(ProgramClass targetClass)
Sets the class to which visited constants will be copied.


getTargetClass

public ProgramClass getTargetClass()
Returns the class to which visited constants will be copied.


getConstantIndex

public int getConstantIndex()
Returns the index of the most recently created constant in the constant pool of the target class.


visitIntegerConstant

public void visitIntegerConstant(Clazz clazz,
                                 IntegerConstant integerConstant)
Specified by:
visitIntegerConstant in interface ConstantVisitor

visitLongConstant

public void visitLongConstant(Clazz clazz,
                              LongConstant longConstant)
Specified by:
visitLongConstant in interface ConstantVisitor

visitFloatConstant

public void visitFloatConstant(Clazz clazz,
                               FloatConstant floatConstant)
Specified by:
visitFloatConstant in interface ConstantVisitor

visitDoubleConstant

public void visitDoubleConstant(Clazz clazz,
                                DoubleConstant doubleConstant)
Specified by:
visitDoubleConstant in interface ConstantVisitor

visitStringConstant

public void visitStringConstant(Clazz clazz,
                                StringConstant stringConstant)
Specified by:
visitStringConstant in interface ConstantVisitor

visitUtf8Constant

public void visitUtf8Constant(Clazz clazz,
                              Utf8Constant utf8Constant)
Specified by:
visitUtf8Constant in interface ConstantVisitor

visitFieldrefConstant

public void visitFieldrefConstant(Clazz clazz,
                                  FieldrefConstant fieldrefConstant)
Specified by:
visitFieldrefConstant in interface ConstantVisitor

visitInterfaceMethodrefConstant

public void visitInterfaceMethodrefConstant(Clazz clazz,
                                            InterfaceMethodrefConstant interfaceMethodrefConstant)
Specified by:
visitInterfaceMethodrefConstant in interface ConstantVisitor

visitMethodrefConstant

public void visitMethodrefConstant(Clazz clazz,
                                   MethodrefConstant methodrefConstant)
Specified by:
visitMethodrefConstant in interface ConstantVisitor

visitClassConstant

public void visitClassConstant(Clazz clazz,
                               ClassConstant classConstant)
Specified by:
visitClassConstant in interface ConstantVisitor

visitNameAndTypeConstant

public void visitNameAndTypeConstant(Clazz clazz,
                                     NameAndTypeConstant nameAndTypeConstant)
Specified by:
visitNameAndTypeConstant in interface ConstantVisitor