Class ScoreMethodAndExtractPathVars
- java.lang.Object
-
- org.wicketstuff.rest.resource.urlsegments.visitor.ScoreMethodAndExtractPathVars
-
- All Implemented Interfaces:
ISegmentVisitor
public class ScoreMethodAndExtractPathVars extends Object implements ISegmentVisitor
Visitor implementation to assign a score to URL segments and to extract path variables. The score is an integer positive value if the string in input is compatible with the current segment, 0 otherwise. Segments of type FixedURLSegment have the priority over the other types of segment. That's why positive matches has a score of 2 for FixedURLSegment, it's 1 for the other types of segment.- Author:
- andrea del bene
-
-
Constructor Summary
Constructors Constructor Description ScoreMethodAndExtractPathVars(MethodMappingInfo methodInfo, PageParameters pageParameters)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addPathVariable(String name, String value)
void
addScore(int partialSocre)
MethodMappingInfo
getMethodInfo()
Map<String,String>
getPathVariables()
int
getScore()
boolean
isSegmentValid()
protected String
segmentActualValue(AbstractURLSegment segment)
Extract segment value from current page parameters.void
visit(FixedURLSegment segment)
void
visit(MultiParamSegment segment)
void
visit(ParamSegment segment)
-
-
-
Constructor Detail
-
ScoreMethodAndExtractPathVars
public ScoreMethodAndExtractPathVars(MethodMappingInfo methodInfo, PageParameters pageParameters)
-
-
Method Detail
-
visit
public void visit(FixedURLSegment segment)
- Specified by:
visit
in interfaceISegmentVisitor
-
visit
public void visit(MultiParamSegment segment)
- Specified by:
visit
in interfaceISegmentVisitor
-
visit
public void visit(ParamSegment segment)
- Specified by:
visit
in interfaceISegmentVisitor
-
segmentActualValue
protected String segmentActualValue(AbstractURLSegment segment)
Extract segment value from current page parameters.- Parameters:
segment
-- Returns:
-
isSegmentValid
public boolean isSegmentValid()
-
addScore
public void addScore(int partialSocre)
-
getScore
public int getScore()
-
getMethodInfo
public MethodMappingInfo getMethodInfo()
-
-