public class LocalVariableTableParameterNameDiscoverer extends java.lang.Object implements ParameterNameDiscoverer
ParameterNameDiscoverer
that uses the LocalVariableTable
information in the method attributes to discover parameter names. Returns
null
if the class file was compiled without debug information.
Uses ObjectWeb's ASM library for analyzing class files. Each discoverer instance caches the ASM discovered information for each introspected Class, in a thread-safe manner. It is recommended to reuse discoverer instances as far as possible.
Modifier and Type | Class and Description |
---|---|
private static class |
LocalVariableTableParameterNameDiscoverer.LocalVariableTableVisitor |
private static class |
LocalVariableTableParameterNameDiscoverer.ParameterNameDiscoveringVisitor
Helper class that inspects all methods (constructor included) and then
attempts to find the parameter names for that member.
|
Modifier and Type | Field and Description |
---|---|
private static Log |
logger |
private static java.util.Map<java.lang.reflect.Member,java.lang.String[]> |
NO_DEBUG_INFO_MAP |
private java.util.Map<java.lang.Class<?>,java.util.Map<java.lang.reflect.Member,java.lang.String[]>> |
parameterNamesCache |
Constructor and Description |
---|
LocalVariableTableParameterNameDiscoverer() |
Modifier and Type | Method and Description |
---|---|
java.lang.String[] |
getParameterNames(java.lang.reflect.Constructor<?> ctor)
Return parameter names for this constructor,
or
null if they cannot be determined. |
java.lang.String[] |
getParameterNames(java.lang.reflect.Method method)
Return parameter names for this method,
or
null if they cannot be determined. |
private java.util.Map<java.lang.reflect.Member,java.lang.String[]> |
inspectClass(java.lang.Class<?> clazz)
Inspects the target class.
|
private static Log logger
private static final java.util.Map<java.lang.reflect.Member,java.lang.String[]> NO_DEBUG_INFO_MAP
private final java.util.Map<java.lang.Class<?>,java.util.Map<java.lang.reflect.Member,java.lang.String[]>> parameterNamesCache
public LocalVariableTableParameterNameDiscoverer()
public java.lang.String[] getParameterNames(java.lang.reflect.Method method)
ParameterNameDiscoverer
null
if they cannot be determined.getParameterNames
in interface ParameterNameDiscoverer
method
- method to find parameter names fornull
if they cannotpublic java.lang.String[] getParameterNames(java.lang.reflect.Constructor<?> ctor)
ParameterNameDiscoverer
null
if they cannot be determined.getParameterNames
in interface ParameterNameDiscoverer
ctor
- constructor to find parameter names fornull
if they cannotprivate java.util.Map<java.lang.reflect.Member,java.lang.String[]> inspectClass(java.lang.Class<?> clazz)