Class AntPathMatcher.AntPatternComparator
- java.lang.Object
-
- com.igormaznitsa.jcp.utils.antpathmatcher.AntPathMatcher.AntPatternComparator
-
- All Implemented Interfaces:
java.util.Comparator<java.lang.String>
- Enclosing class:
- AntPathMatcher
protected static final class AntPathMatcher.AntPatternComparator extends java.lang.Object implements java.util.Comparator<java.lang.String>
The defaultComparator
implementation returned byAntPathMatcher.getPatternComparator(String)
.In order, the most "generic" pattern is determined by the following:
- if it's null or a capture all pattern (i.e. it is equal to "/**")
- if the other pattern is an actual match
- if it's a catch-all pattern (i.e. it ends with "**"
- if it's got more "*" than the other pattern
- if it's got more "{foo}" than the other pattern
- if it's shorter than the other pattern
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
AntPathMatcher.AntPatternComparator.PatternInfo
Value class that holds information about the pattern, e.g.
-
Field Summary
Fields Modifier and Type Field Description private java.lang.String
path
-
Constructor Summary
Constructors Constructor Description AntPatternComparator(java.lang.String path)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compare(java.lang.String pattern1, java.lang.String pattern2)
Compare two patterns to determine which should match first, i.e.
-
-
-
Method Detail
-
compare
public int compare(java.lang.String pattern1, java.lang.String pattern2)
Compare two patterns to determine which should match first, i.e. which is the most specific regarding the current path.- Specified by:
compare
in interfacejava.util.Comparator<java.lang.String>
- Returns:
- a negative integer, zero, or a positive integer as pattern1 is more specific, equally specific, or less specific than pattern2.
-
-