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

pack-priv abstract Class PathElement

extends Object
Class Inheritance
Known Direct Subclasses
org.springframework.web.util.pattern.RegexPathElement, org.springframework.web.util.pattern.SeparatorPathElement, org.springframework.web.util.pattern.SingleCharWildcardedPathElement, org.springframework.web.util.pattern.WildcardPathElement, org.springframework.web.util.pattern.WildcardTheRestPathElement, org.springframework.web.util.pattern.CaptureTheRestPathElement, org.springframework.web.util.pattern.CaptureVariablePathElement, org.springframework.web.util.pattern.LiteralPathElement
Imports
org.springframework.lang.Nullable, org.springframework.util.LinkedMultiValueMap, .MultiValueMap, org.springframework.web.util.pattern.PathPattern.MatchingContext

Common supertype for the Ast nodes created to represent a path pattern.
Authors
Andy Clement, Brian Clozel
Since
5.0

Field Summary

Modifier and TypeField and Description
protected static final int
protected PathElement
protected static final MultiValueMap<String, String>
protected final int
protected PathElement
protected final char
protected static final int

Constructor Summary

AccessConstructor and Description
pack-priv
PathElement(int
the position where this path element starts in the pattern data
pos
,
char
the separator in use in the path pattern
separator
)

Create a new path element.

Method Summary

Modifier and TypeMethod and Description
public int
getCaptureCount()

Return the number of variables captured by the path element.

public abstract char[]
public abstract int

Returns:

the normalized length
getNormalizedLength
()

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

public int
getScore()

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

public int
getWildcardCount()

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

public boolean
isLiteral()

Return whether this PathElement can be strictly compared against another element for matching.

protected final boolean

Returns:

true if the there are no more elements
isNoMorePattern
()

Return if the there are no more PathElements in the pattern.

public abstract boolean

Returns:

true if it matches, otherwise false
matches
(int
the current position within the candidate path
candidatePos
,
PathPattern.MatchingContext
encapsulates context for the match including the candidate
matchingContext
)

Attempt to match this path element.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CAPTURE_VARIABLE_WEIGHTback to summary
protected static final int CAPTURE_VARIABLE_WEIGHT
nextback to summary
protected PathElement next
Annotations
@Nullable
NO_PARAMETERSback to summary
protected static final MultiValueMap<String, String> NO_PARAMETERS
posback to summary
protected final int pos
prevback to summary
protected PathElement prev
Annotations
@Nullable
separatorback to summary
protected final char separator
WILDCARD_WEIGHTback to summary
protected static final int WILDCARD_WEIGHT

Constructor Detail

PathElementback to summary
pack-priv PathElement(int pos, char separator)

Create a new path element.

Parameters
pos:int

the position where this path element starts in the pattern data

separator:char

the separator in use in the path pattern

Method Detail

getCaptureCountback to summary
public int getCaptureCount()

Return the number of variables captured by the path element.

getCharsback to summary
public abstract char[] getChars()
getNormalizedLengthback to summary
public abstract int getNormalizedLength()

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

Returns:int

the normalized length

getScoreback to summary
public int getScore()

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

getWildcardCountback to summary
public int getWildcardCount()

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

isLiteralback to summary
public boolean isLiteral()

Return whether this PathElement can be strictly compared against another element for matching.

isNoMorePatternback to summary
protected final boolean isNoMorePattern()

Return if the there are no more PathElements in the pattern.

Returns:boolean

true if the there are no more elements

matchesback to summary
public abstract boolean matches(int candidatePos, PathPattern.MatchingContext matchingContext)

Attempt to match this path element.

Parameters
candidatePos: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