/** * Finds and invokes a search method whose name is given by searchMethod and whose signature * includes one String, two Integers, and any number of boolean or Booleans * * @param service * @param query * @param context * @return */ private List<T> doPagedSearch(OpenmrsService service, String query, RequestContext context) { try { for (Method candidate : serviceClass.getMethods()) { if (candidate.getName().equals(searchMethod) && hasRightParameterTypes(candidate, 1, 2)) return invokePagedSearchMethod(service, candidate, query, context); } } catch (Exception ex) { throw new RuntimeException(searchMethod + " failed", ex); } throw new RuntimeException("Cannot find suitable method"); }