code: private PatternPathRouterWithGroups.RoutableDestination<HttpResourceModel>
    getMatchedDestination(List<PatternPathRouterWithGroups.RoutableDestination<HttpResourceModel>> routableDestinations,
                          HttpMethod targetHttpMethod, String requestUri) {
  
      LOG.trace("Routable destinations for request {}: {}", requestUri, routableDestinations);
      Iterable<String> requestUriParts = splitAndOmitEmpty(requestUri, '/');
      List<PatternPathRouterWithGroups.RoutableDestination<HttpResourceModel>> matchedDestinations = new ArrayList<>();
      long maxScore = 0;
  
      for (PatternPathRouterWithGroups.RoutableDestination<HttpResourceModel> destination : routableDestinations) {
        HttpResourceModel resourceModel = destination.getDestination();
  
        for (HttpMethod httpMethod : resourceModel.getHttpMethod()) {
          if (targetHttpMethod.equals(httpMethod)) {
            long score = getWeightedMatchScore(requestUriParts, splitAndOmitEmpty(resourceModel.getPath(), '/'));
            LOG.trace("Max score = {}. Weighted score for {} is {}. ", maxScore, destination, score);
            if (score > maxScore) {
              maxScore = score;
              matchedDestinations.clear();
              matchedDestinations.add(destination);
            } else if (score == maxScore) {
              matchedDestinations.add(destination);
            }
          }
        }
      }
  
      if (matchedDestinations.size() > 1) {
        throw new IllegalStateException(String.format("Multiple matched handlers found for request uri %s: %s",
                                                      requestUri, matchedDestinations));
      } else if (matchedDestinations.size() == 1) {
        return matchedDestinations.get(0);
      }
      return null;
    }
docs: Get HttpResourceModel which matches the HttpMethod of the request.
  
  @param routableDestinations List of ResourceModels.
  @param targetHttpMethod HttpMethod.
  @param requestUri request URI.
  @return RoutableDestination that matches httpMethod that needs to be handled. null if there are no matches.