Class AbstractMapper

    • Method Detail

      • getPlaceholder

        protected String getPlaceholder​(String s)
        If the string is in a placeholder format ${key} this method returns the key.
        Parameters:
        s -
        Returns:
        placeholder key or null if string is not in right format
      • getOptionalPlaceholder

        protected String getOptionalPlaceholder​(String s)
        If the string is in an optional parameter placeholder format #{key} this method returns the key.
        Parameters:
        s -
        Returns:
        placeholder key or null if string is not in right format
      • getPlaceholder

        protected String getPlaceholder​(String s,
                                        char startChar)
        If the string is in a placeholder format x{key}, where 'x' can be specified, this method returns the key.
        Parameters:
        s -
        startChar - the character used to indicate the start of the placeholder
        Returns:
        placeholder key or null if string is not in right format
      • urlStartsWith

        protected boolean urlStartsWith​(Url url,
                                        String... segments)
        Returns true if the given url starts with specified segments.
        Parameters:
        url -
        segments -
        Returns:
        true if the URL starts with the specified segments, false otherwise
      • safeSegmentGetter

        protected String safeSegmentGetter​(List<String> segments,
                                           int index,
                                           String defaultValue)
        Utility method to safely get an element from a list of String. If the specified index is bigger than the size of the list the default value is returned.
        Parameters:
        segments -
        index -
        defaultValue -
        Returns:
        the element at the specified position or the default value if the list size is smaller.
      • removeMetaParameter

        protected void removeMetaParameter​(Url urlCopy)
        The new IRequestMappers use the first query parameter to hold meta information about the request like page version, component version, locale, ... The actual IRequestMapper implementation can decide whether the this parameter should be removed before creating PageParameters from the current query parameters
        Parameters:
        urlCopy - the Url that first query parameter has no value
      • getMountSegments

        protected String[] getMountSegments​(String mountPath)
        Convenience method for representing mountPath as array of segments
        Parameters:
        mountPath -
        Returns:
        array of path segments
      • resolveLocale

        protected Locale resolveLocale()
        Returns:
        the locale to use for parsing any numbers in the request parameters