Class InjectionNodes.InjectionNode
java.lang.Object
org.spongepowered.asm.mixin.injection.struct.InjectionNodes.InjectionNode
- All Implemented Interfaces:
Comparable<InjectionNodes.InjectionNode>
- Enclosing class:
InjectionNodes
public static class InjectionNodes.InjectionNode
extends Object
implements Comparable<InjectionNodes.InjectionNode>
A node targetted by one or more injectors. Using this wrapper allows
injectors to be aware of when their target node is removed or replace by
another injector. It also allows injectors to decorate certain nodes with
custom metadata to allow arbitration between injectors to take place.
-
Constructor Summary
ConstructorsConstructorDescriptionInjectionNode(org.objectweb.asm.tree.AbstractInsnNode node) Create a new node wrapper for the specified target node -
Method Summary
Modifier and TypeMethodDescriptionintDecorate this node with arbitrary metadata for injector arbitrationorg.objectweb.asm.tree.AbstractInsnNodeGet the current target of this node, can be null if the node was replaced<V> VgetDecoration(String key) Get the specified decoration<V> VgetDecoration(String key, V defaultValue) Get the specified decoration or default valueintgetId()Get the unique id for this injectororg.objectweb.asm.tree.AbstractInsnNodeGet the original target of this nodebooleanhasDecoration(String key) Get whether this node is decorated with the specified keybooleanGet whether this node has been removedbooleanGet whether this node has been replacedbooleanmatches(org.objectweb.asm.tree.AbstractInsnNode node) Checks whether the original or current target of this node match the specified noderemove()Remove the nodereplace(org.objectweb.asm.tree.AbstractInsnNode target) Replace this node with the specified targettoString()
-
Constructor Details
-
InjectionNode
public InjectionNode(org.objectweb.asm.tree.AbstractInsnNode node) Create a new node wrapper for the specified target node- Parameters:
node- target node
-
-
Method Details
-
getId
public int getId()Get the unique id for this injector -
getOriginalTarget
public org.objectweb.asm.tree.AbstractInsnNode getOriginalTarget()Get the original target of this node -
getCurrentTarget
public org.objectweb.asm.tree.AbstractInsnNode getCurrentTarget()Get the current target of this node, can be null if the node was replaced -
replace
Replace this node with the specified target- Parameters:
target- new node
-
remove
Remove the node -
matches
public boolean matches(org.objectweb.asm.tree.AbstractInsnNode node) Checks whether the original or current target of this node match the specified node- Parameters:
node- node to check- Returns:
- true if the supplied node matches either of this node's internal identities
-
isReplaced
public boolean isReplaced()Get whether this node has been replaced -
isRemoved
public boolean isRemoved()Get whether this node has been removed -
decorate
Decorate this node with arbitrary metadata for injector arbitration- Type Parameters:
V- value type- Parameters:
key- meta keyvalue- meta value
-
hasDecoration
Get whether this node is decorated with the specified key- Parameters:
key- meta key- Returns:
- true if the specified decoration exists
-
getDecoration
Get the specified decoration- Type Parameters:
V- value type- Parameters:
key- meta key- Returns:
- decoration value or null if absent
-
getDecoration
Get the specified decoration or default value- Type Parameters:
V- value type- Parameters:
key- meta keydefaultValue- default value to return- Returns:
- decoration value or null if absent
-
compareTo
- Specified by:
compareToin interfaceComparable<InjectionNodes.InjectionNode>
-
toString
-