Class ElementNode<TNode>

java.lang.Object
org.spongepowered.asm.util.asm.ElementNode<TNode>
Type Parameters:
TNode - node type

public abstract class ElementNode<TNode>
extends java.lang.Object
Holder for FieldNode and MethodNode for consumers which can handle both types (since they have a lot in common), with common accessors for overlapping properties.
  • Constructor Summary

    Constructors
    Modifier Constructor Description
    protected ElementNode​(org.objectweb.asm.tree.ClassNode owner)  
  • Method Summary

    Modifier and Type Method Description
    static java.util.List<ElementNode<org.objectweb.asm.tree.FieldNode>> fieldList​(org.objectweb.asm.tree.ClassNode owner)
    Get a list of wrapped ElementNodes for the fields of the supplied owner class
    abstract TNode get()
    Returns the node with horrible duck typing
    abstract java.lang.String getDesc()
    Get the element descriptor
    org.objectweb.asm.tree.FieldNode getField()
    Get the FieldNode if this member is a field, otherwise returns null
    org.objectweb.asm.tree.MethodNode getMethod()
    Get the MethodNode if this member is a method, otherwise returns null
    abstract java.lang.String getName()
    Get the element name
    org.objectweb.asm.tree.ClassNode getOwner()
    Get the element's owner, can be null
    java.lang.String getOwnerName()
    Get the element owner's name, if this element has an owner, otherwise returns null
    abstract java.lang.String getSignature()
    Get the element signature, can be null
    boolean isField()
    get whether this element is a field
    boolean isMethod()
    Get whether this element is a method
    static <TNode> java.util.List<ElementNode<TNode>> listOf​(org.objectweb.asm.tree.ClassNode owner, java.util.List<TNode> list)
    Convert the supplied list of nodes to a list of wrapped ElementNodes
    static java.util.List<ElementNode<org.objectweb.asm.tree.MethodNode>> methodList​(org.objectweb.asm.tree.ClassNode owner)
    Get a list of wrapped ElementNodes for the methods of the supplied owner class
    static ElementNode<org.objectweb.asm.tree.FieldNode> of​(org.objectweb.asm.tree.ClassNode owner, org.objectweb.asm.tree.FieldNode field)
    Create an ElementNode wrapper for the supplied field node
    static ElementNode<org.objectweb.asm.tree.MethodNode> of​(org.objectweb.asm.tree.ClassNode owner, org.objectweb.asm.tree.MethodNode method)
    Create an ElementNode wrapper for the supplied method node
    static <TNode> ElementNode<TNode> of​(org.objectweb.asm.tree.ClassNode owner, TNode node)
    Create an ElementNode wrapper for the supplied node object

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ElementNode

      protected ElementNode​(org.objectweb.asm.tree.ClassNode owner)
  • Method Details

    • isMethod

      public boolean isMethod()
      Get whether this element is a method
    • isField

      public boolean isField()
      get whether this element is a field
    • getMethod

      public org.objectweb.asm.tree.MethodNode getMethod()
      Get the MethodNode if this member is a method, otherwise returns null
    • getField

      public org.objectweb.asm.tree.FieldNode getField()
      Get the FieldNode if this member is a field, otherwise returns null
    • getOwner

      public org.objectweb.asm.tree.ClassNode getOwner()
      Get the element's owner, can be null
    • getOwnerName

      public java.lang.String getOwnerName()
      Get the element owner's name, if this element has an owner, otherwise returns null
    • getName

      public abstract java.lang.String getName()
      Get the element name
    • getDesc

      public abstract java.lang.String getDesc()
      Get the element descriptor
    • getSignature

      public abstract java.lang.String getSignature()
      Get the element signature, can be null
    • get

      public abstract TNode get()
      Returns the node with horrible duck typing
    • of

      public static ElementNode<org.objectweb.asm.tree.MethodNode> of​(org.objectweb.asm.tree.ClassNode owner, org.objectweb.asm.tree.MethodNode method)
      Create an ElementNode wrapper for the supplied method node
      Parameters:
      owner - class which owns the method or null
      method - Method node to wrap
      Returns:
      ElementNode
    • of

      public static ElementNode<org.objectweb.asm.tree.FieldNode> of​(org.objectweb.asm.tree.ClassNode owner, org.objectweb.asm.tree.FieldNode field)
      Create an ElementNode wrapper for the supplied field node
      Parameters:
      owner - class which owns the field or null
      field - Field node to wrap
      Returns:
      ElementNode
    • of

      public static <TNode> ElementNode<TNode> of​(org.objectweb.asm.tree.ClassNode owner, TNode node)
      Create an ElementNode wrapper for the supplied node object
      Type Parameters:
      TNode - Node type
      Parameters:
      owner - class which owns the node or null
      node - Node to wrap
      Returns:
      ElementNode
      Throws:
      java.lang.IllegalArgumentException - if the supplied argument is not a MethodNode or FieldNode
    • listOf

      public static <TNode> java.util.List<ElementNode<TNode>> listOf​(org.objectweb.asm.tree.ClassNode owner, java.util.List<TNode> list)
      Convert the supplied list of nodes to a list of wrapped ElementNodes
      Type Parameters:
      TNode - Node type
      Parameters:
      owner - Owner of the supplied nodes, can be null
      list - List of nodes
      Returns:
      List of wrapped nodes
    • fieldList

      public static java.util.List<ElementNode<org.objectweb.asm.tree.FieldNode>> fieldList​(org.objectweb.asm.tree.ClassNode owner)
      Get a list of wrapped ElementNodes for the fields of the supplied owner class
      Parameters:
      owner - Class to get fields, must not be null
      Returns:
      List of wrapped nodes
    • methodList

      public static java.util.List<ElementNode<org.objectweb.asm.tree.MethodNode>> methodList​(org.objectweb.asm.tree.ClassNode owner)
      Get a list of wrapped ElementNodes for the methods of the supplied owner class
      Parameters:
      owner - Class to get methods, must not be null
      Returns:
      List of wrapped nodes