FileDocCategorySizeDatePackage
ParamNameExtractor.javaAPI DocApache Axis 1.42295Sat Apr 22 18:57:28 BST 2006org.apache.axis.utils.bytecode

ParamNameExtractor

public class ParamNameExtractor extends Object
This class retieves function parameter names from bytecode built with debugging symbols. Used as a last resort when creating WSDL.
author
Tom Jordahl

Fields Summary
protected static Log
log
Constructors Summary
Methods Summary
public static java.lang.String[]getParameterNamesFromDebugInfo(java.lang.reflect.Method method)
Retrieve a list of function parameter names from a method Returns null if unable to read parameter names (i.e. bytecode not built with debug).


                                 
         
        // Don't worry about it if there are no params.
        int numParams = method.getParameterTypes().length;
        if (numParams == 0)
            return null;

        // get declaring class
        Class c = method.getDeclaringClass();
        
        // Don't worry about it if the class is a Java dynamic proxy 
        if(Proxy.isProxyClass(c)) {
            return null;
        }
        
        try {
            // get a parameter reader
            ParamReader pr = new ParamReader(c);
            // get the paramter names
            String[] names = pr.getParameterNames(method);
            return names;
        } catch (IOException e) {
            // log it and leave
            log.info(Messages.getMessage("error00") + ":" + e);
            return null;
        }