类 InternalPathPatternParser

java.lang.Object
cn.taketoday.web.util.pattern.InternalPathPatternParser

class InternalPathPatternParser extends Object
Parser for URI template patterns. It breaks the path pattern into a number of PathElements in a linked list. Instances are reusable but are not thread-safe.
从以下版本开始:
4.0
作者:
Andy Clement
  • 字段详细资料

    • parser

      private final PathPatternParser parser
    • pathPatternData

      private char[] pathPatternData
    • pathPatternLength

      private int pathPatternLength
    • pos

      int pos
    • singleCharWildcardCount

      private int singleCharWildcardCount
    • wildcard

      private boolean wildcard
    • isCaptureTheRestVariable

      private boolean isCaptureTheRestVariable
    • insideVariableCapture

      private boolean insideVariableCapture
    • variableCaptureCount

      private int variableCaptureCount
    • pathElementStart

      private int pathElementStart
    • variableCaptureStart

      private int variableCaptureStart
    • capturedVariableNames

      @Nullable private ArrayList<String> capturedVariableNames
    • headPE

      @Nullable private PathElement headPE
    • currentPE

      @Nullable private PathElement currentPE
  • 构造器详细资料

  • 方法详细资料

    • parse

      public PathPattern parse(String pathPattern) throws PatternParseException
      Package private delegate for PathPatternParser.parse(String).
      抛出:
      PatternParseException
    • skipCaptureRegex

      private void skipCaptureRegex()
      Just hit a ':' and want to jump over the regex specification for this variable. pos will be pointing at the ':', we want to skip until the }.

      Nested {...} pairs don't have to be escaped: /abc/{var:x{1,2}}/def

      An escaped } will not be treated as the end of the regex: /abc/{var:x\\{y:}/def

      A separator that should not indicate the end of the regex can be escaped:

    • peekDoubleWildcard

      private boolean peekDoubleWildcard()
      After processing a separator, a quick peek whether it is followed by a double wildcard (and only as the last path element).
    • pushPathElement

      private void pushPathElement(PathElement newPathElement)
      Push a path element to the chain being build.
      参数:
      newPathElement - the new path element to add
    • getPathElementText

      private char[] getPathElementText()
    • createPathElement

      private PathElement createPathElement()
      Used the knowledge built up whilst processing since the last path element to determine what kind of path element to create.
      返回:
      the new path element
    • findRegexStart

      private int findRegexStart(char[] data, int offset)
      For a path element representing a captured variable, locate the constraint pattern. Assumes there is a constraint pattern.
      参数:
      data - a complete path expression, e.g. /aaa/bbb/{ccc:...}
      offset - the start of the capture pattern of interest
      返回:
      the index of the character after the ':' within the pattern expression relative to the start of the whole expression
    • resetPathElementState

      private void resetPathElementState()
      Reset all the flags and position markers computed during path element processing.
    • recordCapturedVariable

      private void recordCapturedVariable(int pos, String variableName)
      Record a new captured variable. If it clashes with an existing one then report an error.