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

pack-priv Class CaptureVariablePathElement

extends PathElement
Class Inheritance
Imports
java.util.regex.Matcher, .Pattern, org.springframework.http.server.PathContainer.PathSegment, org.springframework.lang.Nullable

A path element representing capturing a piece of the path as a variable. In the pattern '/foo/{bar}/goo' the {bar} is represented as a CaptureVariablePathElement. There must be at least one character to bind to the variable.
Author
Andy Clement
Since
5.0

Field Summary

Modifier and TypeField and Description
private final Pattern
private final String
Inherited from org.springframework.web.util.pattern.PathElement:
CAPTURE_VARIABLE_WEIGHTnextNO_PARAMETERSposprevseparatorWILDCARD_WEIGHT

Constructor Summary

AccessConstructor and Description
pack-priv
CaptureVariablePathElement(int
the position in the pattern of this capture element
pos
,
char[]
is of the form {AAAAA[:pattern]}
captureDescriptor
,
boolean caseSensitive, char separator)

Create a new CaptureVariablePathElement instance.

Method Summary

Modifier and TypeMethod and Description
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 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.

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

constraintPatternback to summary
private final Pattern constraintPattern
Annotations
@Nullable
variableNameback to summary
private final String variableName

Constructor Detail

CaptureVariablePathElementback to summary
pack-priv CaptureVariablePathElement(int pos, char[] captureDescriptor, boolean caseSensitive, char separator)

Create a new CaptureVariablePathElement instance.

Parameters
pos:int

the position in the pattern of this capture element

captureDescriptor:char[]

is of the form {AAAAA[:pattern]}

Method Detail

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
getVariableNameback to summary
public String getVariableName()
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
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override