private static MethodBindInfo getCandidate()

in src/main/java/com/microsoft/azure/functions/worker/broker/FunctionDefinition.java [46:63]


    private static MethodBindInfo getCandidate(FunctionMethodDescriptor descriptor, Class<?> containingClass) throws NoSuchMethodException {
        List<MethodBindInfo> candidates  = new ArrayList<>();
        for (Method method : containingClass.getMethods()) {
            if (method.getDeclaringClass().getName().equals(descriptor.getFullClassName()) && method.getName().equals(descriptor.getMethodName())) {
                candidates.add(new MethodBindInfo(method));
            }
        }

        if (candidates.isEmpty()) {
            throw new NoSuchMethodException("There are no methods named \"" + descriptor.getName() + "\" in class \"" + descriptor.getFullClassName() + "\"");
        }

        if (candidates.size() > 1) {
            throw new UnsupportedOperationException("Found more than one function with method name \"" + descriptor.getName() + "\" in class \"" + descriptor.getFullClassName() + "\"");
        }

        return candidates.get(0);
    }