Package org.apache.xbean.recipe
Class XbeanAsmParameterNameLoader
java.lang.Object
org.apache.xbean.recipe.XbeanAsmParameterNameLoader
- All Implemented Interfaces:
ParameterNameLoader
Implementation of ParameterNameLoader that uses ASM to read the parameter names from the local variable table in the
class byte code.
This wonderful piece of code was taken from org.springframework.core.LocalVariableTableParameterNameDiscover
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final WeakHashMap
<Constructor, List<String>> Weak map from Constructor to List<String>.private final WeakHashMap
<Method, List<String>> Weak map from Method to List<String>. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static org.objectweb.asm.ClassReader
createClassReader
(Class declaringClass) get
(Constructor constructor) Gets the parameter names of the specified constructor or null if the class was compiled without debug symbols on.Gets the parameter names of the specified method or null if the class was compiled without debug symbols on.getAllConstructorParameters
(Class clazz) Gets the parameter names of all constructor or null if the class was compiled without debug symbols on.getAllMethodParameters
(Class clazz, String methodName) Gets the parameter names of all methods with the specified name or null if the class was compiled without debug symbols on.private Method[]
getMethods
(Class clazz, String methodName)
-
Field Details
-
constructorCache
Weak map from Constructor to List<String>. -
methodCache
Weak map from Method to List<String>.
-
-
Constructor Details
-
XbeanAsmParameterNameLoader
public XbeanAsmParameterNameLoader()
-
-
Method Details
-
get
Gets the parameter names of the specified method or null if the class was compiled without debug symbols on.- Specified by:
get
in interfaceParameterNameLoader
- Parameters:
method
- the method for which the parameter names should be retrieved- Returns:
- the parameter names or null if the class was compilesd without debug symbols on
-
get
Gets the parameter names of the specified constructor or null if the class was compiled without debug symbols on.- Specified by:
get
in interfaceParameterNameLoader
- Parameters:
constructor
- the constructor for which the parameters should be retrieved- Returns:
- the parameter names or null if the class was compiled without debug symbols on
-
getAllConstructorParameters
Gets the parameter names of all constructor or null if the class was compiled without debug symbols on.- Parameters:
clazz
- the class for which the constructor parameter names should be retrieved- Returns:
- a map from Constructor object to the parameter names or null if the class was compiled without debug symbols on
-
getAllMethodParameters
Gets the parameter names of all methods with the specified name or null if the class was compiled without debug symbols on.- Parameters:
clazz
- the class for which the method parameter names should be retrievedmethodName
- the of the method for which the parameters should be retrieved- Returns:
- a map from Method object to the parameter names or null if the class was compiled without debug symbols on
-
getMethods
-
createClassReader
private static org.objectweb.asm.ClassReader createClassReader(Class declaringClass) throws IOException - Throws:
IOException
-