|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.uka.ipd.sdq.ByCounter.utils.MethodDescriptor
public final class MethodDescriptor
Unambiguous description for a method in bytecode compatible format. Such a signature can be constructed through the
constructor MethodDescriptor(..)
and for constructor descriptions through the method
forConstructor(..)
. The descriptor returned by getDescriptor() does not contain a reference to the
containing class anymore.
MethodDescriptor(String, String)
,
Serialized FormConstructor Summary | |
---|---|
MethodDescriptor(java.lang.reflect.Constructor<?> c)
Constructs a MethodDescriptor directly from a Java reflection Constructor. |
|
MethodDescriptor(java.lang.reflect.Method m)
Constructs a MethodDescriptor directly from a Java reflection Method. |
|
MethodDescriptor(java.lang.String canonicalClassName,
java.lang.String signature)
Construct a MethodDescriptor from a Java method signature. |
Method Summary | |
---|---|
static MethodDescriptor |
_constructMethodDescriptorFromASM(java.lang.String owner,
java.lang.String name,
java.lang.String desc)
Construct a MethodDescriptor instance from the details known by ASM. |
static java.lang.String[] |
canonicalClassNameToPackageAndSimpleName(java.lang.String className)
Splits the canonical classname to the package name and the simple class name. |
int |
compareTo(MethodDescriptor o)
|
boolean |
equals(java.lang.Object obj)
Checks for equaling class name, method name, package name and descriptor. |
static int |
findMethodInList(java.util.List<MethodDescriptor> listToSearch,
java.lang.String canonicalClassName,
java.lang.String name,
java.lang.String desc)
Check whether a method matching the given description is contained in the list of methods to instrument and return it's index. |
java.lang.String |
getCanonicalClassName()
|
java.lang.String |
getCanonicalMethodName()
|
java.lang.String |
getClassName()
|
LineNumberRange[] |
getCodeAreasToInstrument()
When the specified areas are not null and not empty, only these areas of the method will be instrumented. |
java.util.UUID |
getContext()
|
java.lang.String |
getDescriptor()
Gets the descriptor string as used in Java bytecode for descriptor. |
boolean |
getIsConstructor()
|
boolean |
getMethodIsStatic()
|
java.lang.String |
getMethodSignature()
Gets the simple method signature of the described method (i.e. without package and/or class names). |
java.lang.String |
getPackageName()
|
static JavaType[] |
getParametersTypesFromDesc(java.lang.String desc)
|
java.lang.String |
getQualifyingMethodName()
Gets the qualifying method name of the described method (yet without the descriptors, i.e. without the input/output parameters). |
java.lang.String |
getQualifyingMethodSignature()
Gets the qualifying method signature of the described method. |
static JavaType |
getReturnTypeFromDesc(java.lang.String desc)
|
java.lang.String |
getSimpleClassName()
|
java.lang.String |
getSimpleMethodName()
Gets the simple method name of the described method. |
boolean |
isConstructor()
|
boolean |
isInlineImmediately()
|
boolean |
isInvariant()
|
static java.lang.String |
removeGenericTyping(java.lang.String signature)
Used for parsing from a Java signature. |
void |
setCodeAreasToInstrument(LineNumberRange[] codeAreasToInstrument)
When the specified areas are not null and not empty, only these areas of the method will be instrumented. |
void |
setContext(java.util.UUID context)
|
void |
setInlineImmediately(boolean inlineImmediately)
Some methods (e.g. those invariant w.r.t. bytecode counts, irrespective of parameters, if any) may not warrant an own CountingResult object, and their counts should be "inlined" immediately instead. |
void |
setInvariant(boolean isInvariant)
Some methods are invariant w.r.t. bytecode counts, i.e. their runtime bytecode counts is constant (invariant) irrespective of method input parameters (if any). |
void |
setPackageName(java.lang.String packageName)
Change the package name to describe a different method. |
void |
setSimpleClassName(java.lang.String className)
Change the class name to describe a different method. |
java.lang.String |
toString_Linebreaks()
Multi line string with the basic properties of this MethodDescriptor . |
java.lang.String |
toString()
One line string with the basic properties of this MethodDescriptor . |
Methods inherited from class java.lang.Object |
---|
getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MethodDescriptor(java.lang.reflect.Constructor<?> c)
c
- Constructor
that is described by the MethodDescriptor.public MethodDescriptor(java.lang.reflect.Method m)
m
- Method that is described by the MethodDescriptor.public MethodDescriptor(java.lang.String canonicalClassName, java.lang.String signature)
canonicalClassName
- The canonical name of the class declaring the method.signature
- A string containing a standard Java method signature with fully qualified types. For example:
public static java.lang.String[] canonicalClassNameToPackageAndSimpleName(java.lang.String className)
Qualifiers defining visibility (like public
) may be omitted (and are ignored), while the
qualifier static
is handled. For method parameters, it is allowed to provide just the
type or the type and its name (example: int[]
or int[] abc
). Generic types
may be omitted (and are ignored) so that List
and List<Integer>
are
treated as the same since bytecode signatures ignore generics. It is advised to take the method
signature from source code or from documentation and only adapt it, if necessary.
Important: The names of object types need to be adapted! So instead of giving the String
String myString
, this has to be expanded to java.lang.String myString
. Note
that inner/nested classes need to be specified using the '$' symbol as in the following example:
my.packagename.OutClass$InnerClass
.
Method Detail |
---|
public static MethodDescriptor _constructMethodDescriptorFromASM(java.lang.String owner, java.lang.String name, java.lang.String desc)
MethodDescriptor
instance from the details known by ASM.
owner
- name
- desc
-
public static java.lang.String[] canonicalClassNameToPackageAndSimpleName(java.lang.String className)
className
- Canonical class name.
public static int findMethodInList(java.util.List<MethodDescriptor> listToSearch, java.lang.String canonicalClassName, java.lang.String name, java.lang.String desc)
listToSearch
- The MethodDescriptor
list to search.canonicalClassName
- The fully qualified class name of the class containing the method.name
- Simple method name (not qualified). For example: getIndexOfMethodMatch
.desc
- A method descriptor as used by Java bytecode. For example:
(Ljava/lang/String;Ljava/lang/String;)Z
InstrumentationParameters
. When
no matching method is found, -1 is returned.public static JavaType[] getParametersTypesFromDesc(java.lang.String desc)
desc
- A parameter descriptor string as used in Java bytecode.
public static JavaType getReturnTypeFromDesc(java.lang.String desc)
desc
- A return value descriptor string as used in Java bytecode.
public static java.lang.String removeGenericTyping(java.lang.String signature)
signature
- A Java signature.
public int compareTo(MethodDescriptor o)
compareTo
in interface java.lang.Comparable<MethodDescriptor>
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String getCanonicalClassName()
public java.lang.String getCanonicalMethodName()
public java.lang.String getClassName()
public LineNumberRange[] getCodeAreasToInstrument()
InstrumentationParameters.getUseBasicBlocks()
public java.util.UUID getContext()
UUID
for this instance of the MethodDescriptor. This can be used to provide context to the
counting of the specified method. Used for debugging at this point.public java.lang.String getDescriptor()
public boolean getIsConstructor()
public boolean getMethodIsStatic()
public java.lang.String getMethodSignature()
public java.lang.String getPackageName()
public java.lang.String getQualifyingMethodName()
public java.lang.String getQualifyingMethodSignature()
getQualifyingMethodName()
) and the descriptor (getDescriptor()
; i.e. with the types of
input/output parameters).
public java.lang.String getSimpleClassName()
public java.lang.String getSimpleMethodName()
public boolean isConstructor()
public boolean isInlineImmediately()
setInlineImmediately(boolean)
public boolean isInvariant()
setInvariant(boolean)
public void setCodeAreasToInstrument(LineNumberRange[] codeAreasToInstrument)
codeAreasToInstrument
- Line numbers that define the instruction blocks that are to be considered as range blocks.InstrumentationParameters.getUseBasicBlocks()
public void setContext(java.util.UUID context)
context
- A new context UUID to set, replacing the old one.getContext()
public void setInlineImmediately(boolean inlineImmediately)
inlineImmediately
- When true, inlining of this method is active.public void setInvariant(boolean isInvariant)
isInvariant
- True marks the method as invariant.public void setPackageName(java.lang.String packageName)
packageName
- The package name to change to.getPackageName()
public void setSimpleClassName(java.lang.String className)
className
- The class name to change to.getSimpleClassName()
public java.lang.String toString()
MethodDescriptor
.
toString
in class java.lang.Object
public java.lang.String toString_Linebreaks()
MethodDescriptor
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |