Package proguard.classfile.editor
Class MemberAdder
- java.lang.Object
-
- proguard.classfile.editor.MemberAdder
-
- All Implemented Interfaces:
MemberVisitor
public class MemberAdder extends java.lang.Object implements MemberVisitor
ThisMemberVisitor
copies all class members that it visits to the given target class. Their processing info is set to the class members from which they were copied.
-
-
Constructor Summary
Constructors Constructor Description MemberAdder(ProgramClass targetClass)
Creates a new MemberAdder that will copy methods into the given target class.MemberAdder(ProgramClass targetClass, MemberVisitor extraMemberVisitor)
Creates a new MemberAdder that will copy methods into the given target class.MemberAdder(ProgramClass targetClass, StringFunction nameTransformer, MemberVisitor extraMemberVisitor)
Creates a new MemberAdder that will copy methods into the given target class.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static void
main(java.lang.String[] args)
This main method illustrates and tests the class, by reading an input class file and copying its class members into a new class that it writes to an output class file.void
visitProgramField(ProgramClass programClass, ProgramField programField)
void
visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface proguard.classfile.visitor.MemberVisitor
visitAnyMember, visitLibraryField, visitLibraryMember, visitLibraryMethod, visitProgramMember
-
-
-
-
Constructor Detail
-
MemberAdder
public MemberAdder(ProgramClass targetClass)
Creates a new MemberAdder that will copy methods into the given target class.- Parameters:
targetClass
- the class to which all visited class members will be added.
-
MemberAdder
public MemberAdder(ProgramClass targetClass, MemberVisitor extraMemberVisitor)
Creates a new MemberAdder that will copy methods into the given target class.- Parameters:
targetClass
- the class to which all visited class members will be added.extraMemberVisitor
- an optional member visitor that visits each new member right after it has been added. This allows changing the processing info, for instance.
-
MemberAdder
public MemberAdder(ProgramClass targetClass, StringFunction nameTransformer, MemberVisitor extraMemberVisitor)
Creates a new MemberAdder that will copy methods into the given target class.- Parameters:
targetClass
- the class to which all visited class members will be added.nameTransformer
- the transformer to be applied to each member's name before copying. If null, the original name will be used.extraMemberVisitor
- an optional member visitor that visits each new member right after it has been added. This allows changing the processing info, for instance.
-
-
Method Detail
-
visitProgramField
public void visitProgramField(ProgramClass programClass, ProgramField programField)
- Specified by:
visitProgramField
in interfaceMemberVisitor
-
visitProgramMethod
public void visitProgramMethod(ProgramClass programClass, ProgramMethod programMethod)
- Specified by:
visitProgramMethod
in interfaceMemberVisitor
-
main
public static void main(java.lang.String[] args)
This main method illustrates and tests the class, by reading an input class file and copying its class members into a new class that it writes to an output class file.
-
-