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
All Methods Instance Methods Concrete Methods 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 decoration<V> VgetDecoration(java.lang.String key, V defaultValue)Get the specified decoration or default valueintgetId()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()
-
-
-
Method Detail
-
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
public InjectionNodes.InjectionNode replace(org.objectweb.asm.tree.AbstractInsnNode target)
Replace this node with the specified target- Parameters:
target- new node
-
remove
public InjectionNodes.InjectionNode 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
public <V> InjectionNodes.InjectionNode decorate(java.lang.String key, V value)
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
-
getDecoration
public <V> V getDecoration(java.lang.String key, V defaultValue)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
public int compareTo(InjectionNodes.InjectionNode other)
- Specified by:
compareToin interfacejava.lang.Comparable<InjectionNodes.InjectionNode>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-