Class ApiNormalisedPath

  • All Implemented Interfaces:
    NormalisedPath

    public class ApiNormalisedPath
    extends Object
    implements NormalisedPath
    This utility normalize the RESTful API path so that they can be handled identically.
    Author:
    Steve Hu
    • Constructor Detail

      • ApiNormalisedPath

        public ApiNormalisedPath​(String path,
                                 String basePath)
        Construct normalized path
        Parameters:
        path - original path
        basePath - the path you want to overwrite - put null will use the base path parsed from OpenApiHelper - put "" empty String will not trigger any overwrites - put regex will replace the first basePath with empty String
    • Method Detail

      • part

        public String part​(int index)
        Specified by:
        part in interface NormalisedPath
        Parameters:
        index - position of part
        Returns:
        The path part at the given index
      • isParam

        public boolean isParam​(int index)
        Specified by:
        isParam in interface NormalisedPath
        Parameters:
        index - position of part
        Returns:
        Whether the path part at the given index is a path param (e.g. "/my/{param}/")
      • paramName

        public String paramName​(int index)
        Specified by:
        paramName in interface NormalisedPath
        Parameters:
        index - position of part
        Returns:
        The parameter name of the path part at the given index, or null
      • normalised

        public String normalised()
        Specified by:
        normalised in interface NormalisedPath
        Returns:
        The normalised path string, with prefixes removed and a standard treatment for leading/trailing slashed.