Package org.slf4j.instrumentation
Class JavassistHelper
- java.lang.Object
-
- org.slf4j.instrumentation.JavassistHelper
-
public class JavassistHelper extends java.lang.Object
Helper methods for Javassist functionality.
-
-
Constructor Summary
Constructors Constructor Description JavassistHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getSignature(javassist.CtBehavior method)
Return javassist source snippet which lists all the parameters and their values.private static boolean
methodReturnsValue(javassist.CtBehavior method)
determine if the given method returns a value, and return true if so.(package private) static java.lang.String
parameterNameFor(javassist.CtBehavior method, javassist.bytecode.LocalVariableAttribute locals, int i)
Determine the name of parameter with index i in the given method.static java.lang.String
returnValue(javassist.CtBehavior method)
Create a javassist source snippet which either is empty (for anything which does not return a value) or a explanatory text around the $_ javassist return value variable.
-
-
-
Method Detail
-
returnValue
public static java.lang.String returnValue(javassist.CtBehavior method) throws javassist.NotFoundException
Create a javassist source snippet which either is empty (for anything which does not return a value) or a explanatory text around the $_ javassist return value variable.- Parameters:
method
- descriptor of method- Returns:
- source snippet
- Throws:
javassist.NotFoundException
-
methodReturnsValue
private static boolean methodReturnsValue(javassist.CtBehavior method) throws javassist.NotFoundException
determine if the given method returns a value, and return true if so. false otherwise.- Parameters:
method
-- Returns:
- Throws:
javassist.NotFoundException
-
getSignature
public static java.lang.String getSignature(javassist.CtBehavior method) throws javassist.NotFoundException
Return javassist source snippet which lists all the parameters and their values. If available the source names are extracted from the debug information and used, otherwise just a number is shown.- Parameters:
method
-- Returns:
- Throws:
javassist.NotFoundException
-
parameterNameFor
static java.lang.String parameterNameFor(javassist.CtBehavior method, javassist.bytecode.LocalVariableAttribute locals, int i)
Determine the name of parameter with index i in the given method. Use the locals attributes about local variables from the classfile. Note: This is still work in progress.- Parameters:
method
-locals
-i
-- Returns:
- the name of the parameter if available or a number if not.
-
-