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.

@param method
@return
@throws NotFoundException
438096
public static String getSignature(CtBehavior method) throws NotFoundException {

        CtClass[] parameterTypes = method.getParameterTypes();

        CodeAttribute codeAttribute = method.getMethodInfo().getCodeAttribute();

        LocalVariableAttribute locals = null;

        if (codeAttribute != null) {
            AttributeInfo attribute;
            attribute = codeAttribute.getAttribute("LocalVariableTable");
            locals = (LocalVariableAttribute) attribute;
        }

        String methodName = method.getName();

        StringBuilder sb = new StringBuilder(methodName).append("(\" ");
        for (int i = 0; i < parameterTypes.length; i++) {
            if (i > 0) {
                // add a comma and a space between printed values
                sb.append(" + \", \" ");
            }

            CtClass parameterType = parameterTypes[i];
            boolean isArray = parameterType.isArray();
            CtClass arrayType = parameterType.getComponentType();
            if (isArray) {
                while (arrayType.isArray()) {
                    arrayType = arrayType.getComponentType();
                }
            }

            sb.append(" + \"");
            try {
                sb.append(parameterNameFor(method, locals, i));
            } catch (Exception e) {
                sb.append(i + 1);
            }
            sb.append("\" + \"=");

            if (parameterType.isPrimitive()) {
                // let the compiler handle primitive -> string
                sb.append("\"+ $").append(i + 1);
            } else {
                String s = "org.slf4j.instrumentation.ToStringHelper.render";
                sb.append("\"+ ").append(s).append("($").append(i + 1).append(')');
            }
        }
        sb.append("+\")");

        String signature = sb.toString();
        return signature;
    }
28834
public static String propertyName(Method method) {
        if (!is(method)) {
            throw new IllegalArgumentException("Method: " + method + " is not a real getter.");
        }
        String name = method.getName();

        if (name.startsWith(GET_PREFIX)) {
            return name.substring(GET_PREFIX.length());
        } else if (name.startsWith(IS_PREFIX)) {
            return name.substring(IS_PREFIX.length());
        } else if (name.startsWith(SHOULD_PREFIX)) {
            name = name.substring(SHOULD_PREFIX.length());
        } else {
            throw new IllegalStateException("Method: " + method + " is a getter but couldn't find a valid prefix.");
        }

        if (name.length() == 1) {
            return name.toUpperCase();
        }
        return name.substring(0, 1).toUpperCase() + name.substring(1);
    }
754195
static Method getMethodByName(Method[] methods, String methodName) {
		for (int i = 0; i < methods.length; i++)
			if (methods[i].getName().equalsIgnoreCase(methodName))
				return methods[i];
		return null;
	}
269550
private String getAction(final Annotation[] annotations, final Method method) {
        for (final Annotation annotation : annotations) {
            if (annotation instanceof Audit) {
                final Audit audit = (Audit) annotation;
                String action = audit.action();
                if (ACTION.equals(action)) {
                    return method.getName();
                } else {
                    return action;
                }
            }
        }
        return null;
    }
126518
static boolean isGetterMethod(final Method method) {
        return (method.getName().startsWith(GETTER_GET_METHOD_PREFIX)
                || method.getName().startsWith(GETTER_IS_METHOD_PREFIX))
                &&
                !Void.TYPE.isAssignableFrom(method.getReturnType())
                &&
                !method.isVarArgs()
                &&
                method.getParameterTypes().length == 0;
    }
892901
String getStaticTopic(Method method) {
		if(null == method || !method.isAnnotationPresent(JsTopic.class) ) {
			return null;
		}
		JsTopic jsTopic = method.getAnnotation(JsTopic.class);
		return jsTopic.value();
	}
86115
String getCppName(Method method) {
        ClassMapping mapping = mappings.get(method.getDeclaringClass());

        if (mapping != null) {
            String name = method.getName() + "(" + Datatype.generateJNISignature(method.getParameterTypes()) + ")";
            Wrappe wrappedMethod = mapping.getMethods().findWrappe(name);
            if (wrappedMethod != null && !Utils.isNullOrEmpty(wrappedMethod.getCppName())) {
                return wrappedMethod.getCppName();
            }
        }
        Java4CppWrappe annot = method.getAnnotation(Java4CppWrappe.class);
        if (annot != null && !Utils.isNullOrEmpty(annot.value())) {
            return annot.value();
        }
        return mappings.escapeName(method.getName());
    }
582869
public static String convertMethodSignature(JavaClass javaClass, Method method) {
        return convertMethodSignature(javaClass.getClassName(), method.getName(), method.getSignature());
    }
1272021
public Content getSignature(MethodDoc method) {
        Content pre = new HtmlTree(HtmlTag.PRE);
        writer.addAnnotationInfo(method, pre);
        addModifiers(method, pre);
        addTypeParameters(method, pre);
        addReturnType(method, pre);
        if (configuration.linksource) {
            Content methodName = new StringContent(method.name());
            writer.addSrcLink(method, methodName, pre);
        } else {
            addName(method.name(), pre);
        }
        int indent = pre.charCount();
        addParameters(method, pre, indent);
        addExceptions(method, pre, indent);
        return pre;
    }
811654
public Map<ValueNumber, Integer> getValueNumberToParamMap(Method method) {
        return getValueNumberToParamMap(method.getSignature(), method.isStatic());
    }
307144
private EJBInterceptorBinding findInterceptorBindingForMethod(final Method method)
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
        {
            Tr.entry(tc, "findInterceptorBindingForMethod: " + method.toString());
        }

        // Use style 4 binding if there is one for the method.
        String methodSignature = MethodAttribUtils.methodSignature(method);
        if (isTraceOn && tc.isDebugEnabled())
        {
            Tr.debug(tc, "lookup style 4 for method signature: " + methodSignature);
        }
        EJBInterceptorBinding binding = ivStyle4InterceptorBindingMap.get(methodSignature);

        // If no Style 4 binding, then see if there is a Style 3 binding.
        if (binding == null)
        {
            String methodName = method.getName();
            if (isTraceOn && tc.isDebugEnabled())
            {
                Tr.debug(tc, "lookup style 3 for method: " + methodName);
            }
            binding = ivStyle3InterceptorBindingMap.get(methodName);
        }

        if (isTraceOn && tc.isEntryEnabled())
        {
            if (binding != null)
            {
                Tr.exit(tc, "findInterceptorBindingForMethod found: ");
                binding.dump();
            }
            else
            {
                Tr.exit(tc, "findInterceptorBindingForMethod, interceptor-binding not found");
            }
        }
        return binding;
    }
1145112
public static List<List<Annotation>> findAndMergeParameterAnnotations(Method method) {
        List<List<Annotation>> res = new ArrayList<List<Annotation>>(method.getParameterTypes().length);
        for (int i = 0; i < method.getParameterTypes().length; i++) {
            res.add(new LinkedList<Annotation>());
        }
        findAndMergeAnnotations(method.getDeclaringClass(), method, res);
        return res;
    }
785044
function _keySourceHintFrom( method, source, environment ){
		var hints = [];
		if( method ) hints.push( method );
		if( source ) hints.push( source );
		if( environment ) hints.push( "WHEN " + environment );

		return hints.join(' ');
	}
666326
private static List<Annotation> getAnnotations(Method method) {
		if (methodAnnotationCache.containsKey(method)) {
			return methodAnnotationCache.get(method);
		}
		List<Annotation> annotations = new ArrayList<>();
		Collections.addAll(annotations, method.getAnnotations());
		annotations = Collections.unmodifiableList(annotations);
		methodAnnotationCache.put(method, annotations);
		return annotations;
	}
828539
public static MethodDescriptor getMethodDescriptor(JavaClass jclass, Method method) {
        return DescriptorFactory.instance().getMethodDescriptor(jclass.getClassName().replace('.', '/'), method.getName(),
                method.getSignature(), method.isStatic());
    }
1210845
public static Map<Integer, List<AnnotationInstance>> createParameterAnnotationMap(final MethodInfo method) {
        final Map<Integer, List<AnnotationInstance>> result = new HashMap<>();
        for (AnnotationInstance ai : method.annotations()) {
            final AnnotationTarget at = ai.target();
            if (at.kind() == AnnotationTarget.Kind.METHOD_PARAMETER) {
                final MethodParameterInfo mp = at.asMethodParameter();
                final int pos = (int) mp.position();
                List<AnnotationInstance> list = result.get(pos);
                if (list == null) {
                    list = new ArrayList<>();
                    result.put(pos, list);
                }
                list.add(ai);
            }
        }
        return result;
    }
1279800
private static String getClassMethod(Class clazz, Method method) {
		StringBuilder builder = new StringBuilder();
		builder.append(clazz.getName()).append(".").append(method.getName());
		builder.append("(");
		if (method.getParameterCount() > 0) {
			for (int i = 0; i < method.getParameterCount(); i++) {
				Parameter param = method.getParameters()[i];
				builder.append(param.getType().getSimpleName()).append(" ").append(param.getName());

				if (i + 1 < method.getParameterCount()) {
					builder.append(", ");
				}
			}
		}
		builder.append(")");
		return builder.toString();
	}