private static PathMapping pathStringMapping(String pathPrefix, Method method,
                                                 Set<Annotation> methodAnnotations) {
        pathPrefix = ensureAbsolutePath(pathPrefix, "pathPrefix");
        if (!pathPrefix.endsWith("/")) {
            pathPrefix += '/';
        }

        final String pattern = findPattern(method, methodAnnotations);
        final PathMapping mapping = PathMapping.of(pattern);
        if ("/".equals(pathPrefix)) {
            // pathPrefix is not specified or "/".
            return mapping;
        }

        if (pattern.startsWith(EXACT)) {
            return PathMapping.ofExact(concatPaths(
                    pathPrefix, pattern.substring(EXACT.length())));
        }

        if (pattern.startsWith(PREFIX)) {
            return PathMapping.ofPrefix(concatPaths(
                    pathPrefix, pattern.substring(PREFIX.length())));
        }

        if (pattern.startsWith(GLOB)) {
            final String glob = pattern.substring(GLOB.length());
            if (glob.startsWith("/")) {
                return PathMapping.ofGlob(concatPaths(pathPrefix, glob));
            } else {
                // NB: We cannot use PathMapping.ofGlob(pathPrefix + "/**/" + glob) here
                //     because that will extract '/**/' as a path parameter, which a user never specified.
                return new PrefixAddingPathMapping(pathPrefix, mapping);
            }
        }

        if (pattern.startsWith(REGEX)) {
            return new PrefixAddingPathMapping(pathPrefix, mapping);
        }

        if (pattern.startsWith("/")) {
            // Default pattern
            return PathMapping.of(concatPaths(pathPrefix, pattern));
        }

        // Should never reach here because we validated the path pattern.
        throw new Error();
    }
private static PathMapping pathStringMapping ( String pathPrefix , Method method , Set < Annotation > methodAnnotations ) { pathPrefix = ensureAbsolutePath ( pathPrefix , "pathPrefix" ) ; if ( ! pathPrefix . endsWith ( "/" ) ) { pathPrefix += '/' ; } final String pattern = findPattern ( method , methodAnnotations ) ; final PathMapping mapping = PathMapping . of ( pattern ) ; if ( "/" . equals ( pathPrefix ) ) { return mapping ; } if ( pattern . startsWith ( EXACT ) ) { return PathMapping . ofExact ( concatPaths ( pathPrefix , pattern . substring ( EXACT . length ( ) ) ) ) ; } if ( pattern . startsWith ( PREFIX ) ) { return PathMapping . ofPrefix ( concatPaths ( pathPrefix , pattern . substring ( PREFIX . length ( ) ) ) ) ; } if ( pattern . startsWith ( GLOB ) ) { final String glob = pattern . substring ( GLOB . length ( ) ) ; if ( glob . startsWith ( "/" ) ) { return PathMapping . ofGlob ( concatPaths ( pathPrefix , glob ) ) ; } else { return new PrefixAddingPathMapping ( pathPrefix , mapping ) ; } } if ( pattern . startsWith ( REGEX ) ) { return new PrefixAddingPathMapping ( pathPrefix , mapping ) ; } if ( pattern . startsWith ( "/" ) ) { return PathMapping . of ( concatPaths ( pathPrefix , pattern ) ) ; } throw new Error ( ) ; }
Returns the {@link PathMapping} instance mapped to {@code method}.