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
    int compareTo​(InjectionNodes.InjectionNode other)  
    <V> InjectionNodes.InjectionNode decorate​(java.lang.String key, V value)
    Decorate this node with arbitrary metadata for injector arbitration
    org.objectweb.asm.tree.AbstractInsnNode getCurrentTarget()
    Get the current target of this node, can be null if the node was replaced
    <V> V getDecoration​(java.lang.String key)
    Get the specified decoration
    int getId()
    Get the unique id for this injector
    org.objectweb.asm.tree.AbstractInsnNode getOriginalTarget()
    Get the original target of this node
    boolean hasDecoration​(java.lang.String key)
    Get whether this node is decorated with the specified key
    boolean isRemoved()
    Get whether this node has been removed
    boolean isReplaced()
    Get whether this node has been replaced
    boolean matches​(org.objectweb.asm.tree.AbstractInsnNode node)
    Checks whether the original or current target of this node match the specified node
    InjectionNodes.InjectionNode remove()
    Remove the node
    InjectionNodes.InjectionNode replace​(org.objectweb.asm.tree.AbstractInsnNode target)
    Replace this node with the specified target
    java.lang.String toString()  

    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

      public InjectionNodes.InjectionNode replace​(org.objectweb.asm.tree.AbstractInsnNode target)
      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

      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 key
      value - 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

      public int compareTo​(InjectionNodes.InjectionNode other)
      Specified by:
      compareTo in interface java.lang.Comparable<InjectionNodes.InjectionNode>
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object