Class PathUtil


  • public final class PathUtil
    extends Object
    Utilities for working with API Description paths and path-parameters.
    • Method Detail

      • buildPath

        public static String buildPath​(String segment,
                                       String... moreSegments)
        Builds a forward-slash-delimited path, with duplicate forward-slashes removed, and trailing slashes removed.
        Parameters:
        segment - First path segment
        moreSegments - Additional path segments or null
        Returns:
        Path
      • buildPathParameters

        public static Parameter[] buildPathParameters​(String pathSegment)
        Searches for curly-braces in the given pathSegment, and creates a path-parameter for each that are found.
        Parameters:
        pathSegment - Path-segment
        Returns:
        Path-parameters or null
      • mergeParameters

        public static List<Parameter> mergeParameters​(List<Parameter> parameterList,
                                                      Parameter... parameters)
        Merges Parameter values into the given parameterList, where conflicting parameter-names will be replaced, and new parameters will otherwise be added.
        Parameters:
        parameterList - Current list of parameters
        parameters - Additional parameters to merge or null
        Returns:
        parameterList field