Class InjectionNodes.InjectionNode
java.lang.Object
org.spongepowered.asm.mixin.injection.struct.InjectionNodes.InjectionNode
- All Implemented Interfaces:
java.lang.Comparable<InjectionNodes.InjectionNode>
- Enclosing class:
- InjectionNodes
public static class InjectionNodes.InjectionNode extends java.lang.Object implements java.lang.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
Constructors Constructor Description InjectionNode(org.objectweb.asm.tree.AbstractInsnNode node)Create a new node wrapper for the specified target node -
Method Summary
Modifier and Type Method Description intcompareTo(InjectionNodes.InjectionNode other)<V> InjectionNodes.InjectionNodedecorate(java.lang.String key, V value)Decorate this node with arbitrary metadata for injector arbitrationorg.objectweb.asm.tree.AbstractInsnNodegetCurrentTarget()Get the current target of this node, can be null if the node was replaced<V> VgetDecoration(java.lang.String key)Get the specified decorationintgetId()Get the unique id for this injectororg.objectweb.asm.tree.AbstractInsnNodegetOriginalTarget()Get the original target of this nodebooleanhasDecoration(java.lang.String key)Get whether this node is decorated with the specified keybooleanisRemoved()Get whether this node has been removedbooleanisReplaced()Get 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 nodeInjectionNodes.InjectionNoderemove()Remove the nodeInjectionNodes.InjectionNodereplace(org.objectweb.asm.tree.AbstractInsnNode target)Replace this node with the specified targetjava.lang.StringtoString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
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
public boolean hasDecoration(java.lang.String key)Get whether this node is decorated with the specified key- Parameters:
key- meta key- Returns:
- true if the specified decoration exists
-
getDecoration
public <V> V getDecoration(java.lang.String key)Get the specified decoration- Type Parameters:
V- value type- Parameters:
key- meta key- Returns:
- decoration value or null if absent
-
compareTo
- Specified by:
compareToin interfacejava.lang.Comparable<InjectionNodes.InjectionNode>
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-