Package com.tonic.analysis.common
Class MethodReference
- java.lang.Object
-
- com.tonic.analysis.common.MethodReference
-
public class MethodReference extends Object
An immutable method identity of owner class, name, and descriptor.
-
-
Constructor Summary
Constructors Constructor Description MethodReference(String owner, String name, String descriptor)Creates a new method reference.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)StringgetDescriptor()StringgetDisplayName()Renders the reference with the dotted class name and a summarized parameter list.StringgetFullReference()Alias forgetFullSignature().StringgetFullSignature()Concatenates owner, name and descriptor into a single identifying string.StringgetName()StringgetOwner()StringgetShortDisplayName()Renders the reference with the simple class name and a summarized parameter list.inthashCode()booleanisConstructor()Tests whether the name is the constructor name.booleanisStaticInitializer()Tests whether the name is the static initializer name.StringtoString()
-
-
-
Constructor Detail
-
MethodReference
public MethodReference(String owner, String name, String descriptor)
Creates a new method reference.- Parameters:
owner- the internal name of the class that owns this method (e.g., "java/lang/String")name- the method name (e.g., "toString", "<init>")descriptor- the method descriptor (e.g., "()Ljava/lang/String;")
-
-
Method Detail
-
getOwner
public String getOwner()
- Returns:
- the internal name of the owning class
-
getName
public String getName()
- Returns:
- the method name
-
getDescriptor
public String getDescriptor()
- Returns:
- the method descriptor
-
getFullSignature
public String getFullSignature()
Concatenates owner, name and descriptor into a single identifying string.- Returns:
- the signature, such as "java/lang/String.toString()Ljava/lang/String;"
-
isConstructor
public boolean isConstructor()
Tests whether the name is the constructor name.- Returns:
- true if the name is <init>
-
isStaticInitializer
public boolean isStaticInitializer()
Tests whether the name is the static initializer name.- Returns:
- true if the name is <clinit>
-
getDisplayName
public String getDisplayName()
Renders the reference with the dotted class name and a summarized parameter list.- Returns:
- the display string, such as "com.example.MyClass.methodName()"
-
getShortDisplayName
public String getShortDisplayName()
Renders the reference with the simple class name and a summarized parameter list.- Returns:
- the short display string
-
getFullReference
public String getFullReference()
Alias forgetFullSignature().- Returns:
- the fully qualified signature
-
-