Package org.spongepowered.asm.util.asm
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 protectedElementNode(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 classabstract TNodeget()Returns the node with horrible duck typingabstract java.lang.StringgetDesc()Get the element descriptororg.objectweb.asm.tree.FieldNodegetField()Get theFieldNodeif this member is a field, otherwise returns nullorg.objectweb.asm.tree.MethodNodegetMethod()Get theMethodNodeif this member is a method, otherwise returns nullabstract java.lang.StringgetName()Get the element nameorg.objectweb.asm.tree.ClassNodegetOwner()Get the element's owner, can be nulljava.lang.StringgetOwnerName()Get the element owner's name, if this element has an owner, otherwise returns nullabstract java.lang.StringgetSignature()Get the element signature, can be nullbooleanisField()get whether this element is a fieldbooleanisMethod()Get whether this element is a methodstatic <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 ElementNodesstatic 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 classstatic 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 nodestatic 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 nodestatic <TNode> ElementNode<TNode>of(org.objectweb.asm.tree.ClassNode owner, TNode node)Create an ElementNode wrapper for the supplied node objectMethods 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 theMethodNodeif this member is a method, otherwise returns null -
getField
public org.objectweb.asm.tree.FieldNode getField()Get theFieldNodeif 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
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 nullmethod- 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 nullfield- Field node to wrap- Returns:
- ElementNode
-
of
Create an ElementNode wrapper for the supplied node object- Type Parameters:
TNode- Node type- Parameters:
owner- class which owns the node or nullnode- Node to wrap- Returns:
- ElementNode
- Throws:
java.lang.IllegalArgumentException- if the supplied argument is not aMethodNodeorFieldNode
-
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 nulllist- 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
-