public class InsnListUtils
extends java.lang.Object
InsnList
s.Constructor and Description |
---|
InsnListUtils() |
Modifier and Type | Method and Description |
---|---|
static org.objectweb.asm.tree.InsnList |
between(org.objectweb.asm.tree.AbstractInsnNode startNode,
org.objectweb.asm.tree.AbstractInsnNode endNode)
Creates a sublist with all the nodes between the given extremes.
|
static void |
cut(org.objectweb.asm.tree.InsnList list,
int amount,
boolean reverse)
Cut a number of nodes from the list.
|
static org.objectweb.asm.tree.InsnList |
of(org.objectweb.asm.tree.AbstractInsnNode... nodes)
Factory method that builds an
InsnList with the given nodes. |
static boolean |
replace(org.objectweb.asm.tree.InsnList list,
int opcode,
org.objectweb.asm.tree.AbstractInsnNode newNode,
int amount,
boolean reverse)
Replaces n occurrences of said opcode with the given node.
|
static void |
replaceNode(org.objectweb.asm.tree.InsnList list,
org.objectweb.asm.tree.AbstractInsnNode oldNode,
org.objectweb.asm.tree.AbstractInsnNode newNode)
Replaces a node with another one.
|
public static org.objectweb.asm.tree.InsnList of(org.objectweb.asm.tree.AbstractInsnNode... nodes)
InsnList
with the given nodes.nodes
- the nodes in questionInsnList
public static org.objectweb.asm.tree.InsnList between(org.objectweb.asm.tree.AbstractInsnNode startNode, org.objectweb.asm.tree.AbstractInsnNode endNode)
startNode
- the starting node of the pattern, must be non-nullendNode
- the first node of the pattern, must be non-nullInsnList
public static void replaceNode(org.objectweb.asm.tree.InsnList list, org.objectweb.asm.tree.AbstractInsnNode oldNode, org.objectweb.asm.tree.AbstractInsnNode newNode)
list
- the list to perform the operation onoldNode
- node to replacenewNode
- new nodepublic static boolean replace(org.objectweb.asm.tree.InsnList list, int opcode, org.objectweb.asm.tree.AbstractInsnNode newNode, int amount, boolean reverse)
list
- the list to perform the operation onopcode
- the opcode to replacenewNode
- the replacement nodereverse
- whether the search should be done from the endamount
- how many occurrences to replace, set to 0 to replace allpublic static void cut(org.objectweb.asm.tree.InsnList list, int amount, boolean reverse)
list
- the list to perform the operation onamount
- how many nodes to cutreverse
- true if it should cut from the end, false otherwise