Class AsmParameterNameLoader

java.lang.Object
org.apache.xbean.recipe.AsmParameterNameLoader
All Implemented Interfaces:
ParameterNameLoader

public class AsmParameterNameLoader extends Object implements 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
  • Constructor Details

    • AsmParameterNameLoader

      public AsmParameterNameLoader()
  • Method Details

    • get

      public List<String> get(Method method)
      Gets the parameter names of the specified method or null if the class was compiled without debug symbols on.
      Specified by:
      get in interface ParameterNameLoader
      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

      public List<String> get(Constructor constructor)
      Gets the parameter names of the specified constructor or null if the class was compiled without debug symbols on.
      Specified by:
      get in interface ParameterNameLoader
      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

      public Map<Constructor,List<String>> getAllConstructorParameters(Class clazz)
      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

      public Map<Method,List<String>> 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.
      Parameters:
      clazz - the class for which the method parameter names should be retrieved
      methodName - 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