public class InitializerEditor extends java.lang.Object implements AttributeVisitor
Modifier and Type | Class and Description |
---|---|
static interface |
InitializerEditor.CodeBuilder
This functional interface provides an instruction sequence builder to its caller.
|
Constructor and Description |
---|
InitializerEditor(ProgramClass programClass)
Creates a new InitializerEditor for the given class.
|
Modifier and Type | Method and Description |
---|---|
void |
addInitializerInstructions(InitializerEditor.CodeBuilder codeBuilder)
Adds the specified initialization instructions to the edited class.
|
void |
addInitializerInstructions(Instruction[] instructions)
Adds the given initialization instructions to the edited class.
|
void |
addStaticInitializerInstructions(boolean mergeIntoExistingInitializer,
InitializerEditor.CodeBuilder codeBuilder)
Adds the specified static initializer instructions to the edited class.
|
void |
addStaticInitializerInstructions(boolean mergeIntoExistingInitializer,
Instruction[] instructions)
Adds the given static initializer instructions to the edited class.
|
void |
visitAnyAttribute(Clazz clazz,
Attribute attribute)
Visits any Attribute instance.
|
void |
visitCodeAttribute(Clazz clazz,
Method method,
CodeAttribute codeAttribute) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
visitAnnotationDefaultAttribute, visitAnyAnnotationsAttribute, visitAnyParameterAnnotationsAttribute, visitAnyTypeAnnotationsAttribute, visitBootstrapMethodsAttribute, visitConstantValueAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitDeprecatedAttribute, visitEnclosingMethodAttribute, visitExceptionsAttribute, visitInnerClassesAttribute, visitLineNumberTableAttribute, visitLocalVariableTableAttribute, visitLocalVariableTypeTableAttribute, visitMethodParametersAttribute, visitModuleAttribute, visitModuleMainClassAttribute, visitModulePackagesAttribute, visitNestHostAttribute, visitNestMembersAttribute, visitPermittedSubclassesAttribute, visitRecordAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleAnnotationsAttribute, visitRuntimeInvisibleParameterAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeInvisibleTypeAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleAnnotationsAttribute, visitRuntimeVisibleParameterAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitRuntimeVisibleTypeAnnotationsAttribute, visitSignatureAttribute, visitSignatureAttribute, visitSignatureAttribute, visitSignatureAttribute, visitSignatureAttribute, visitSourceDebugExtensionAttribute, visitSourceDirAttribute, visitSourceFileAttribute, visitStackMapAttribute, visitStackMapTableAttribute, visitSyntheticAttribute, visitSyntheticAttribute, visitSyntheticAttribute, visitSyntheticAttribute, visitUnknownAttribute
public InitializerEditor(ProgramClass programClass)
programClass
- The class to be edited.public void addStaticInitializerInstructions(boolean mergeIntoExistingInitializer, InitializerEditor.CodeBuilder codeBuilder)
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.codeBuilder
- The provider of a builder to add instructions. This functional interface can
conveniently be implemented as a closure.public void addStaticInitializerInstructions(boolean mergeIntoExistingInitializer, Instruction[] instructions)
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.instructions
- The instructions to be added.public void addInitializerInstructions(InitializerEditor.CodeBuilder codeBuilder)
codeBuilder
- The provider of a builder to add instructions. This functional interface can
conveniently be implemented as a closure.public void addInitializerInstructions(Instruction[] instructions)
instructions
- The instructions to be added.public void visitAnyAttribute(Clazz clazz, Attribute attribute)
AttributeVisitor
visitAnyAttribute
in interface AttributeVisitor
public void visitCodeAttribute(Clazz clazz, Method method, CodeAttribute codeAttribute)
visitCodeAttribute
in interface AttributeVisitor