public class SimplifiedClassEditor extends SimplifiedVisitor implements AttributeVisitor
| Constructor and Description |
|---|
SimplifiedClassEditor(int u2accessFlags,
String className)
Creates a new SimplifiedClassEditor for the Java class with the given
name.
|
SimplifiedClassEditor(int u2accessFlags,
String className,
String superclassName)
Creates a new SimplifiedClassEditor for the Java class with the given
name and super class.
|
SimplifiedClassEditor(ProgramClass programClass)
Creates a new SimplifiedClassEditor for the given class.
|
| Modifier and Type | Method and Description |
|---|---|
int |
addClassConstant(String name,
Clazz referencedClass)
Adds the given class constant to the edited class.
|
SimplifiedClassEditor |
addField(int u2accessFlags,
String fieldName,
String fieldDescriptor)
Adds a new field to the edited class.
|
void |
addInitializerInstructions(Instruction[] instructions)
Adds the given initialization instructions to the edited class.
|
CompactCodeAttributeComposer |
addMethod(int u2accessFlags,
String methodName,
String methodDescriptor,
Clazz[] referencedClasses,
int maxCodeFragmentLength)
Adds a new method to the edited class.
|
ProgramMethod |
addMethod(int u2accessFlags,
String methodName,
String methodDescriptor,
Instruction[] instructions)
Adds a new method to the edited class, with the given instructions array.
|
CompactCodeAttributeComposer |
addMethod(int u2accessFlags,
String methodName,
String methodDescriptor,
int maxCodeFragmentLength)
Adds a new method to the edited class.
|
void |
addStaticInitializerInstructions(Instruction[] instructions,
boolean mergeIntoExistingInitializer)
Adds the given static initializer instructions to the edited class.
|
void |
finishEditing()
Finalizes the editing of the class.
|
void |
finishEditing(ClassPool programClassPool,
ClassPool libraryClassPool)
Finalizes the editing of the class, and initializes all references
of the edited class w.r.t.
|
ProgramClass |
getProgramClass()
Returns the edited ProgramClass instance.
|
void |
visitAnyAttribute(Clazz clazz,
Attribute attribute)
Visit any type of attribute.
|
void |
visitCodeAttribute(Clazz clazz,
Method method,
CodeAttribute codeAttribute) |
visitAnnotation, visitAnnotation, visitAnnotation, visitAnnotation, visitAnnotation, visitAnnotation, visitAnnotationDefaultAttribute, visitAnnotationElementValue, visitAnyAnnotationsAttribute, visitAnyClass, visitAnyConstant, visitAnyElementValue, visitAnyInstruction, visitAnyMember, visitAnyMethodrefConstant, visitAnyParameterAnnotationsAttribute, visitAnyPrimitiveArrayConstant, visitAnyPrimitiveArrayConstantElement, visitAnyRefConstant, visitAnyStackMapFrame, visitAnySwitchInstruction, visitAnyTargetInfo, visitAnyTypeAnnotationsAttribute, visitAnyVerificationType, visitArrayElementValue, visitBooleanArrayConstant, visitBooleanArrayConstantElement, visitBootstrapMethodsAttribute, visitBranchInstruction, visitByteArrayConstant, visitByteArrayConstantElement, visitCatchTargetInfo, visitCharArrayConstant, visitCharArrayConstantElement, visitClassConstant, visitClassElementValue, visitConstantElementValue, visitConstantInstruction, visitConstantValueAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitDoubleArrayConstant, visitDoubleArrayConstantElement, visitDoubleConstant, visitDoubleType, visitDynamicConstant, visitEmptyTargetInfo, visitEmptyTargetInfo, visitEmptyTargetInfo, visitEnclosingMethodAttribute, visitEnumConstantElementValue, visitExceptionsAttribute, visitFieldrefConstant, visitFloatArrayConstant, visitFloatArrayConstantElement, visitFloatConstant, visitFloatType, visitFormalParameterTargetInfo, visitFullFrame, visitInnerClassesAttribute, visitIntArrayConstant, visitIntArrayConstantElement, visitIntegerConstant, visitIntegerType, visitInterfaceMethodrefConstant, visitInvokeDynamicConstant, visitLessZeroFrame, visitLibraryClass, visitLibraryField, visitLibraryMember, visitLibraryMethod, visitLineNumberTableAttribute, visitLocalVariableTableAttribute, visitLocalVariableTargetInfo, visitLocalVariableTypeTableAttribute, visitLongArrayConstant, visitLongArrayConstantElement, visitLongConstant, visitLongType, visitLookUpSwitchInstruction, visitMethodHandleConstant, visitMethodParametersAttribute, visitMethodrefConstant, visitMethodTypeConstant, visitModuleAttribute, visitModuleConstant, visitModuleMainClassAttribute, visitModulePackagesAttribute, visitMoreZeroFrame, visitNameAndTypeConstant, visitNestHostAttribute, visitNestMembersAttribute, visitNullType, visitObjectType, visitOffsetTargetInfo, visitPackageConstant, visitPrimitiveArrayConstant, visitProgramClass, visitProgramField, visitProgramMember, visitProgramMethod, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleParameterAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleParameterAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitSameOneFrame, visitSameZeroFrame, visitShortArrayConstant, visitShortArrayConstantElement, visitSignatureAttribute, visitSignatureAttribute, visitSignatureAttribute, visitSignatureAttribute, visitSimpleInstruction, visitSourceDirAttribute, visitSourceFileAttribute, visitStackDoubleType, visitStackFloatType, visitStackIntegerType, visitStackLongType, visitStackMapAttribute, visitStackMapTableAttribute, visitStackNullType, visitStackObjectType, visitStackTopType, visitStackUninitializedThisType, visitStackUninitializedType, visitStringConstant, visitSuperTypeTargetInfo, visitSyntheticAttribute, visitSyntheticAttribute, visitSyntheticAttribute, visitSyntheticAttribute, visitTableSwitchInstruction, visitThrowsTargetInfo, visitTopType, visitTypeAnnotation, visitTypeAnnotation, visitTypeAnnotation, visitTypeAnnotation, visitTypeAnnotation, visitTypeAnnotation, visitTypeArgumentTargetInfo, visitTypeParameterBoundTargetInfo, visitTypeParameterBoundTargetInfo, visitTypeParameterBoundTargetInfo, visitTypeParameterBoundTargetInfo, visitTypeParameterTargetInfo, visitTypeParameterTargetInfo, visitTypePathInfo, visitTypePathInfo, visitTypePathInfo, visitTypePathInfo, visitTypePathInfo, visitUninitializedThisType, visitUninitializedType, visitUnknownAttribute, visitUtf8Constant, visitVariableInstruction, visitVariablesDoubleType, visitVariablesFloatType, visitVariablesIntegerType, visitVariablesLongType, visitVariablesNullType, visitVariablesObjectType, visitVariablesTopType, visitVariablesUninitializedThisType, visitVariablesUninitializedTypeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitvisitAnnotationDefaultAttribute, visitBootstrapMethodsAttribute, visitConstantValueAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitEnclosingMethodAttribute, visitExceptionsAttribute, visitInnerClassesAttribute, visitLineNumberTableAttribute, visitLocalVariableTableAttribute, visitLocalVariableTypeTableAttribute, visitMethodParametersAttribute, visitModuleAttribute, visitModuleMainClassAttribute, visitModulePackagesAttribute, visitNestHostAttribute, visitNestMembersAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleParameterAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleParameterAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitSignatureAttribute, visitSignatureAttribute, visitSignatureAttribute, visitSourceDirAttribute, visitSourceFileAttribute, visitStackMapAttribute, visitStackMapTableAttribute, visitSyntheticAttribute, visitSyntheticAttribute, visitSyntheticAttribute, visitUnknownAttributepublic SimplifiedClassEditor(int u2accessFlags,
String className)
u2accessFlags - access flags for the new class.className - the fully qualified name of the new class.ClassConstantspublic SimplifiedClassEditor(int u2accessFlags,
String className,
String superclassName)
u2accessFlags - access flags for the new class.className - the fully qualified name of the new class.superclassName - the fully qualified name of the super class.ClassConstantspublic SimplifiedClassEditor(ProgramClass programClass)
programClass - the class to be edited.public void finishEditing()
getProgramClass().finishEditing(ClassPool, ClassPool)public void finishEditing(ClassPool programClassPool, ClassPool libraryClassPool)
getProgramClass().programClassPool - the program class poollibraryClassPool - the library class poolpublic ProgramClass getProgramClass()
finishEditing(),
finishEditing(ClassPool, ClassPool)public int addClassConstant(String name, Clazz referencedClass)
name - the class name to be added.referencedClass - the corresponding referenced class.public SimplifiedClassEditor addField(int u2accessFlags, String fieldName, String fieldDescriptor)
u2accessFlags - acces flags for the new field.fieldName - name of the new field.fieldDescriptor - descriptor of the new field.public CompactCodeAttributeComposer addMethod(int u2accessFlags, String methodName, String methodDescriptor, int maxCodeFragmentLength)
u2accessFlags - acces flags for the new method.methodName - name of the new method.methodDescriptor - descriptor of the new method.maxCodeFragmentLength - maximum length for the code fragment of the
new method.public CompactCodeAttributeComposer addMethod(int u2accessFlags, String methodName, String methodDescriptor, Clazz[] referencedClasses, int maxCodeFragmentLength)
u2accessFlags - acces flags for the new method.methodName - name of the new method.methodDescriptor - descriptor of the new method.referencedClasses - the classes referenced by the method descriptor.maxCodeFragmentLength - maximum length for the code fragment of the
new method.public ProgramMethod addMethod(int u2accessFlags, String methodName, String methodDescriptor, Instruction[] instructions)
u2accessFlags - acces flags for the new method.methodName - name of the new method.methodDescriptor - descriptor of the new method.instructions - the instructions of the new method.public void addStaticInitializerInstructions(Instruction[] instructions, boolean mergeIntoExistingInitializer)
instructions - the instructions to be added.mergeIntoExistingInitializer - indicates whether the instructions should
be added to the existing static initializer
(if it exists), or if a new method should
be created, which is then called from the
existing initializer.public void addInitializerInstructions(Instruction[] instructions)
instructions - the instructions to be added.public void visitAnyAttribute(Clazz clazz, Attribute attribute)
SimplifiedVisitorvisitAnyAttribute in class SimplifiedVisitorpublic void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
visitCodeAttribute in interface AttributeVisitorvisitCodeAttribute in class SimplifiedVisitorCopyright © 2019. All rights reserved.