Top Description Fields Constructors Methods
org.springframework.web.util.pattern

pack-priv Class RegexPathElement

extends PathElement
Class Inheritance
Imports
java.util.ArrayList, .List, java.util.regex.Matcher, .Pattern, org.springframework.http.server.PathContainer.PathSegment, org.springframework.web.util.pattern.PathPattern.MatchingContext

A regex path element. Used to represent any complicated element of the path.

For example in '/foo/*_*/*_{foobar}' both *_* and *_{foobar} are regex path elements.

Derived from the general org.springframework.util.AntPathMatcher approach.

Author
Andy Clement
Since
5.0

Field Summary

Modifier and TypeField and Description
private final boolean
private static final String
private static final Pattern
private final Pattern
private final char[]
private final List<String>
private int
Inherited from org.springframework.web.util.pattern.PathElement:
CAPTURE_VARIABLE_WEIGHTnextNO_PARAMETERSposprevseparatorWILDCARD_WEIGHT

Constructor Summary

AccessConstructor and Description
pack-priv
RegexPathElement(int pos, char[] regex, boolean caseSensitive, char[] completePattern, char separator)

Method Summary

Modifier and TypeMethod and Description
public Pattern
buildPattern(char[] regex, char[] completePattern)

public int
getCaptureCount()

Overrides org.springframework.web.util.pattern.PathElement.getCaptureCount.

Return the number of variables captured by the path element.
public char[]
public int
getNormalizedLength()

Implements abstract org.springframework.web.util.pattern.PathElement.getNormalizedLength.

Return the length of the path element where captures are considered to be one character long.
public int
getScore()

Overrides org.springframework.web.util.pattern.PathElement.getScore.

Return the score for this PathElement, combined score is used to compare parsed patterns.
public List<String>
public int
getWildcardCount()

Overrides org.springframework.web.util.pattern.PathElement.getWildcardCount.

Return the number of wildcard elements (*, ?) in the path element.
public boolean
matches(int
the current position within the candidate path
pathIndex
,
PathPattern.MatchingContext
encapsulates context for the match including the candidate
matchingContext
)

Implements abstract org.springframework.web.util.pattern.PathElement.matches.

Attempt to match this path element.
private String
quote(String s, int start, int end)

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from org.springframework.web.util.pattern.PathElement:
isLiteralisNoMorePattern

Field Detail

caseSensitiveback to summary
private final boolean caseSensitive
DEFAULT_VARIABLE_PATTERNback to summary
private static final String DEFAULT_VARIABLE_PATTERN
GLOB_PATTERNback to summary
private static final Pattern GLOB_PATTERN
patternback to summary
private final Pattern pattern
regexback to summary
private final char[] regex
variableNamesback to summary
private final List<String> variableNames
wildcardCountback to summary
private int wildcardCount

Constructor Detail

RegexPathElementback to summary
pack-priv RegexPathElement(int pos, char[] regex, boolean caseSensitive, char[] completePattern, char separator)

Method Detail

buildPatternback to summary
public Pattern buildPattern(char[] regex, char[] completePattern)
getCaptureCountback to summary
public int getCaptureCount()

Overrides org.springframework.web.util.pattern.PathElement.getCaptureCount.

Doc from org.springframework.web.util.pattern.PathElement.getCaptureCount.

Return the number of variables captured by the path element.

Annotations
@Override
getCharsback to summary
public char[] getChars()

Implements abstract org.springframework.web.util.pattern.PathElement.getChars.

Annotations
@Override
getNormalizedLengthback to summary
public int getNormalizedLength()

Implements abstract org.springframework.web.util.pattern.PathElement.getNormalizedLength.

Doc from org.springframework.web.util.pattern.PathElement.getNormalizedLength.

Return the length of the path element where captures are considered to be one character long.

Returns:int

the normalized length

Annotations
@Override
getScoreback to summary
public int getScore()

Overrides org.springframework.web.util.pattern.PathElement.getScore.

Doc from org.springframework.web.util.pattern.PathElement.getScore.

Return the score for this PathElement, combined score is used to compare parsed patterns.

Annotations
@Override
getVariableNamesback to summary
public List<String> getVariableNames()
getWildcardCountback to summary
public int getWildcardCount()

Overrides org.springframework.web.util.pattern.PathElement.getWildcardCount.

Doc from org.springframework.web.util.pattern.PathElement.getWildcardCount.

Return the number of wildcard elements (*, ?) in the path element.

Annotations
@Override
matchesback to summary
public boolean matches(int pathIndex, PathPattern.MatchingContext matchingContext)

Implements abstract org.springframework.web.util.pattern.PathElement.matches.

Doc from org.springframework.web.util.pattern.PathElement.matches.

Attempt to match this path element.

Parameters
pathIndex:int

the current position within the candidate path

matchingContext:PathPattern.MatchingContext

encapsulates context for the match including the candidate

Returns:boolean

true if it matches, otherwise false

Annotations
@Override
quoteback to summary
private String quote(String s, int start, int end)
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override