private static Map<HttpMethod, List<String>> getHttpMethodPatternsMap(Method method,
                                                                          Set<Annotation> methodAnnotations) {
        final List<String> pathPatterns = AnnotationUtil.findAll(method, Path.class).stream().map(Path::value)
                                                        .collect(toImmutableList());
        final boolean usePathPatterns = !pathPatterns.isEmpty();

        final Map<HttpMethod, List<String>> httpMethodAnnotatedPatternMap =
                getHttpMethodAnnotatedPatternMap(methodAnnotations);
        if (httpMethodAnnotatedPatternMap.isEmpty()) {
            throw new IllegalArgumentException(method.getDeclaringClass().getName() + '#' + method.getName() +
                                               " must have an HTTP method annotation.");
        }
        return httpMethodAnnotatedPatternMap.entrySet().stream().collect(
                ImmutableMap.toImmutableMap(
                        Entry::getKey,
                        entry -> {
                            final List<String> httpMethodPaths = entry.getValue();
                            if (usePathPatterns && !httpMethodPaths.isEmpty()) {
                                throw new IllegalArgumentException(
                                        method.getDeclaringClass().getName() + '#' + method.getName() +
                                        " cannot specify both an HTTP mapping and a Path mapping.");
                            }
                            if (usePathPatterns) {
                                httpMethodPaths.addAll(pathPatterns);
                            } else if (httpMethodPaths.isEmpty()) {
                                // Add an empty value if HTTP method annotation value is empty or not specified.
                                httpMethodPaths.add("");
                            }
                            return ImmutableList.copyOf(httpMethodPaths);
                        }));
    }
Returns path patterns for each {@link HttpMethod}. The path pattern might be specified by
{@link Path} or HTTP method annotations such as {@link Get} and {@link Post}. Path patterns
may be specified by either HTTP method annotations, or {@link Path} annotations but not both
simultaneously.
core/src/main/java/com/linecorp/armeria/internal/server/annotation/AnnotatedServiceFactory.java