类 InsnList
java.lang.Object
cn.taketoday.bytecode.tree.InsnList
- 所有已实现的接口:
Iterable<AbstractInsnNode>
A doubly linked list of
AbstractInsnNode objects. This implementation is not thread
safe.-
嵌套类概要
嵌套类 -
字段概要
字段修饰符和类型字段说明(专用程序包) AbstractInsnNode[]A cache of the instructions of this list.private AbstractInsnNodeThe first instruction in this list.private AbstractInsnNodeThe last instruction in this list.private intThe number of instructions in this list. -
构造器概要
构造器 -
方法概要
修饰符和类型方法说明voidaccept(MethodVisitor methodVisitor) Makes the given visitor visit all the instructions in this list.voidadd(AbstractInsnNode insnNode) Adds the given instruction to the end of this list.voidAdds the given instructions to the end of this list.voidclear()Removes all the instructions of this list.booleancontains(AbstractInsnNode insnNode) Returns true if the given instruction belongs to this list.get(int index) Returns the instruction whose index is given.getFirst()Returns the first instruction in this list.getLast()Returns the last instruction in this list.intindexOf(AbstractInsnNode insnNode) Returns the index of the given instruction in this list.voidinsert(AbstractInsnNode insnNode) Inserts the given instruction at the beginning of this list.voidinsert(AbstractInsnNode previousInsn, AbstractInsnNode insnNode) Inserts the given instruction after the specified instruction.voidinsert(AbstractInsnNode previousInsn, InsnList insnList) Inserts the given instructions after the specified instruction.voidInserts the given instructions at the beginning of this list.voidinsertBefore(AbstractInsnNode nextInsn, AbstractInsnNode insnNode) Inserts the given instruction before the specified instruction.voidinsertBefore(AbstractInsnNode nextInsn, InsnList insnList) Inserts the given instructions before the specified instruction.iterator()Returns an iterator over the instructions in this list.iterator(int index) Returns an iterator over the instructions in this list.voidremove(AbstractInsnNode insnNode) Removes the given instruction from this list.(专用程序包) voidremoveAll(boolean mark) Removes all the instructions of this list.voidResets all the labels in the instruction list.voidset(AbstractInsnNode oldInsnNode, AbstractInsnNode newInsnNode) Replaces an instruction of this list with another instruction.intsize()Returns the number of instructions in this list.toArray()Returns an array containing all the instructions in this list.从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait从接口继承的方法 java.lang.Iterable
forEach, spliterator
-
字段详细资料
-
size
private int sizeThe number of instructions in this list. -
firstInsn
The first instruction in this list. May be null. -
lastInsn
The last instruction in this list. May be null. -
cache
AbstractInsnNode[] cacheA cache of the instructions of this list. This cache is used to improve the performance of theget(int)method.
-
-
构造器详细资料
-
InsnList
public InsnList()
-
-
方法详细资料
-
size
public int size()Returns the number of instructions in this list.- 返回:
- the number of instructions in this list.
-
getFirst
Returns the first instruction in this list.- 返回:
- the first instruction in this list, or null if the list is empty.
-
getLast
Returns the last instruction in this list.- 返回:
- the last instruction in this list, or null if the list is empty.
-
get
Returns the instruction whose index is given. This method builds a cache of the instructions in this list to avoid scanning the whole list each time it is called. Once the cache is built, this method runs in constant time. This cache is invalidated by all the methods that modify the list.- 参数:
index- the index of the instruction that must be returned.- 返回:
- the instruction whose index is given.
- 抛出:
IndexOutOfBoundsException- if (index < 0 || index >= size()).
-
contains
Returns true if the given instruction belongs to this list. This method always scans the instructions of this list until it finds the given instruction or reaches the end of the list.- 参数:
insnNode- an instruction.- 返回:
- true if the given instruction belongs to this list.
-
indexOf
Returns the index of the given instruction in this list. This method builds a cache of the instruction indexes to avoid scanning the whole list each time it is called. Once the cache is built, this method run in constant time. The cache is invalidated by all the methods that modify the list.- 参数:
insnNode- an instruction of this list.- 返回:
- the index of the given instruction in this list. The result of this method is
undefined if the given instruction does not belong to this list. Use
contains(cn.taketoday.bytecode.tree.AbstractInsnNode)to test if an instruction belongs to an instruction list or not.
-
accept
Makes the given visitor visit all the instructions in this list.- 参数:
methodVisitor- the method visitor that must visit the instructions.
-
iterator
Returns an iterator over the instructions in this list.- 指定者:
iterator在接口中Iterable<AbstractInsnNode>- 返回:
- an iterator over the instructions in this list.
-
iterator
Returns an iterator over the instructions in this list.- 参数:
index- index of instruction for the iterator to start at.- 返回:
- an iterator over the instructions in this list.
-
toArray
Returns an array containing all the instructions in this list.- 返回:
- an array containing all the instructions in this list.
-
set
Replaces an instruction of this list with another instruction.- 参数:
oldInsnNode- an instruction of this list.newInsnNode- another instruction, which must not belong to anyInsnList.
-
add
Adds the given instruction to the end of this list.- 参数:
insnNode- an instruction, which must not belong to anyInsnList.
-
add
Adds the given instructions to the end of this list.- 参数:
insnList- an instruction list, which is cleared during the process. This list must be different from 'this'.
-
insert
Inserts the given instruction at the beginning of this list.- 参数:
insnNode- an instruction, which must not belong to anyInsnList.
-
insert
Inserts the given instructions at the beginning of this list.- 参数:
insnList- an instruction list, which is cleared during the process. This list must be different from 'this'.
-
insert
Inserts the given instruction after the specified instruction.- 参数:
previousInsn- an instruction of this list after which insnNode must be inserted.insnNode- the instruction to be inserted, which must not belong to anyInsnList.
-
insert
Inserts the given instructions after the specified instruction.- 参数:
previousInsn- an instruction of this list after which the instructions must be inserted.insnList- the instruction list to be inserted, which is cleared during the process. This list must be different from 'this'.
-
insertBefore
Inserts the given instruction before the specified instruction.- 参数:
nextInsn- an instruction of this list before which insnNode must be inserted.insnNode- the instruction to be inserted, which must not belong to anyInsnList.
-
insertBefore
Inserts the given instructions before the specified instruction.- 参数:
nextInsn- an instruction of this list before which the instructions must be inserted.insnList- the instruction list to be inserted, which is cleared during the process. This list must be different from 'this'.
-
remove
Removes the given instruction from this list.- 参数:
insnNode- the instruction of this list that must be removed.
-
removeAll
void removeAll(boolean mark) Removes all the instructions of this list.- 参数:
mark- if the instructions must be marked as no longer belonging to anyInsnList.
-
clear
public void clear()Removes all the instructions of this list. -
resetLabels
public void resetLabels()Resets all the labels in the instruction list. This method should be called before reusing an instruction list between severalClassWriters.
-