/*
Collect the set of RESTful methods for a single class when it is being unregistered
190366
private void removeResourceMethods(Object theProvider, Class<?> clazz, Collection<String> resourceNames) throws ConfigurationException {
		for (Method m : ReflectionUtil.getDeclaredMethods(clazz)) {
			BaseMethodBinding<?> foundMethodBinding = BaseMethodBinding.bindMethod(m, getFhirContext(), theProvider);
			if (foundMethodBinding == null) {
				continue; // not a bound method
			}
			if (foundMethodBinding instanceof ConformanceMethodBinding) {
				myServerConformanceMethod = null;
				continue;
			}
			String resourceName = foundMethodBinding.getResourceName();
			if (!resourceNames.contains(resourceName)) {
				resourceNames.add(resourceName);
			}
		}
	}
1370500
public static Method[] getMethods(Class<?> beanClass) throws SecurityException {
		Method[] allMethods = METHODS_CACHE.get(beanClass);
		if (null != allMethods) {
			return allMethods;
		}

		allMethods = getMethodsDirectly(beanClass, true);
		return METHODS_CACHE.put(beanClass, allMethods);
	}
842211
private static Method getMethod(final Class cls, final String methodName, boolean declared) {
		$.checkNotEmpty(methodName);
		List<Method> methods = getMethodsList(cls, declared);
		for (int i = 0; i < methods.size(); i++) {
			if (methodName.equals(methods.get(i).getName())) {
				return methods.get(i);
			}
		}
		return null;
	}
1249599
private static Set<String> excludedMethods(String... methodNames)
   {
      Set<String> set = new HashSet<String>(MpxjTreeNode.DEFAULT_EXCLUDED_METHODS);
      set.addAll(Arrays.asList(methodNames));
      return set;
   }
128813
private static List<MethodInfo> getPublicMethodInfos(final JavaClass cls) {
        List<MethodInfo> methodInfos = new ArrayList<>();
        Method[] methods = cls.getMethods();
        for (Method m : methods) {
            if ((m.getAccessFlags() & (Const.ACC_PUBLIC | Const.ACC_PROTECTED)) != 0) {
                ExceptionTable et = m.getExceptionTable();
                methodInfos
                        .add(new MethodInfo(m.getName(), m.getSignature(), et == null ? null : et.getExceptionNames()));
            }
        }
        return methodInfos;
    }
316696
public static String[] getMissingSipMethods(Collection<String> sipMethods) {
        String[] methods = {};
        if (sipMethods.size() > 0 && sipMethods.containsAll(ALL_SIP_METHODS) == false) {
            HashSet<String> missingMethods = new HashSet<String>(ALL_SIP_METHODS);
            missingMethods.removeAll(sipMethods);
            methods = new String[missingMethods.size()];
            missingMethods.toArray(methods);
        }
        return methods;
    }
1182073
public static List<Method> retrieveMethodList(final Class<?> cls, final String methodName) {
        final List<Method> methodList = new ArrayList<>();
        final String camelCasedMethodName = underscoreToCamelCase(methodName);
        for (final Method m : cls.getMethods()) {
            if (m.getName().equals(camelCasedMethodName) || m.getName().equals(methodName)) {
                methodList.add(m);
            }
        }
        return methodList;
    }
1011505
public Method[] getMethods(Class clazz, Collection.Key methodName, int count) {
	Map<Key, Array> methodsMap = map.get(clazz);
	if (methodsMap == null) methodsMap = store(clazz);

	Array methods = methodsMap.get(methodName);
	if (methods == null) return null;

	Object o = methods.get(count + 1, null);
	if (o == null) return null;
	return (Method[]) o;
    }
341789
private void collectBindings(List<SitebricksModule.LinkingBinder> bindings,
                               Set<PageBook.Page> pagesToCompile) {

    // Reverse the method map for easy lookup of HTTP method annotations.
    Map<Class<? extends Annotation>, String> methodSet = null;

    //go thru bindings and obtain pages from them.
    for (SitebricksModule.LinkingBinder binding : bindings) {

      if (EMBEDDED == binding.bindingKind) {
        if (null == binding.embedAs) {
          // This can happen if embed() is not followed by an .as(..)
          throw new IllegalStateException("embed() missing .as() clause: " + binding.pageClass);
        }
        registry.addEmbed(binding.embedAs);
        pagesToCompile.add(pageBook.embedAs(binding.pageClass, binding.embedAs));

      } else if (PAGE == binding.bindingKind) {
        pagesToCompile.add(pageBook.at(binding.uri, binding.pageClass));

      } else if (STATIC_RESOURCE == binding.bindingKind) {
        //localize the resource to the SitebricksModule's package.
        resourcesService.add(SitebricksModule.class, binding.getResource());
      } else if (SERVICE == binding.bindingKind) {
        pagesToCompile.add(pageBook.serviceAt(binding.uri, binding.pageClass));
      } else if (ACTION == binding.bindingKind) {
        // Lazy create this inverse lookup map, once.
        if (null == methodSet) {
          methodSet = HashBiMap.create(methodMap).inverse();
        }
        pageBook.at(binding.uri, binding.actionDescriptors, methodSet);
      }
    }
  }
485175
private static List<Method> getAnnotatedMethods(Class<?> clazz){
		List<Method> methods = new ArrayList<Method>();
		
		for(Method method:getAllMethods(clazz))
			if(!isNull(method.getAnnotation(JMapConversion.class)))
				methods.add(method);
		
		return methods;
	}
1075546
function unwrapAllMethods() {
    wrappers.forEach(function (item) {
        var obj = item.obj;
        obj[item.name] = item.method;
    });
    wrappers = [];
}
150219
private static Set<Method> findMethods(
      final MasterClass masterClass,
      final GuestClass guestClass,
      final String methodName,
      final ReturnClass returnClass,
      final MethodsSource nextMethodsSource) {
    final Set<Method> methods = nextMethodsSource.findMethods();
    final MethodsSource emptyMethods = new EmptyMethods();
    for (final Class<?> guestInterface : guestClass.toClass().getInterfaces()) {
      try {
        final Method method = masterClass.toClass().getMethod(methodName, guestInterface);
        if (returnClass.toClass().isAssignableFrom(method.getReturnType())) {
          methods.add(method);
        }
      } catch (final NoSuchMethodException ignored) {
      }
      methods.addAll(ByParameterInterfaces.findMethods(masterClass,
                                                       new GuestClass(guestInterface),
                                                       methodName,
                                                       returnClass,
                                                       emptyMethods));
    }
    return methods;
  }
168780
public static void checkUnusedParameters(SQLiteModelMethod method, Set<String> usedMethodParameters, TypeName excludedClasses) {
		int paramsCount = method.getParameters().size();
		int usedCount = usedMethodParameters.size();

		if (paramsCount > usedCount) {
			StringBuilder sb = new StringBuilder();
			String separator = "";
			for (Pair<String, TypeName> item : method.getParameters()) {
				if (excludedClasses != null && item.value1.equals(excludedClasses)) {
					usedCount++;
				} else {
					if (!usedMethodParameters.contains(item.value0)) {
						sb.append(separator + "'" + item.value0 + "'");
						separator = ", ";
					}
				}
			}

			if (paramsCount > usedCount) {
				throw (new InvalidMethodSignException(method, "unused parameter(s) " + sb.toString()));
			}
		}
	}
6506
public Set<Method> getMethods(boolean privileged) {
      if (privileged) {
         return Collections.unmodifiableSet(Sets.union(methods, declaredMethods));
      } else {
         return Collections.unmodifiableSet(methods);
      }
   }
1165049
public static Method[] collectMethods(Class<?> clazz, String name, int include, int exclude) {
        final List<Method> result = new ArrayList<>();
        collectMethods(result, new ArrayList<Class<?>[]>(), new HashSet<Class<?>>(), clazz, name, include, exclude);
        return result.toArray(new Method[result.size()]);
    }
301060
private static Map<String, Method> serviceMethods(Class<?> serviceInterface) {
    Map<String, Method> methods =
        Arrays.stream(serviceInterface.getMethods())
            .filter(method -> method.isAnnotationPresent(ServiceMethod.class))
            .collect(
                Collectors.toMap(
                    method -> {
                      ServiceMethod methodAnnotation = method.getAnnotation(ServiceMethod.class);
                      return isNullOrEmpty(methodAnnotation.value())
                          ? method.getName()
                          : methodAnnotation.value();
                    },
                    Function.identity()));

    return Collections.unmodifiableMap(methods);
  }
350444
def method_missing(method, *args, &block)
      return super unless method =~ /^find_(all_|last_|or_(initialize_|create_))?by_/

      result = object_class.send(method, *args, &block)
      options = args.extract_options!

      if method =~ /^find_all/
        decorate_collection(result, options)
      else
        decorate(result, options)
      end
    end