Package com.day.cq.wcm.commons
Class GlobPattern
java.lang.Object
com.day.cq.wcm.commons.GlobPattern
The
This class is copied from
GlobPattern implements matching operations that do a
pattern globbing.
This class is copied from
day-commons-text and should not
be used anymore. switch to regexp patterns if possible.-
Constructor Summary
ConstructorsConstructorDescriptionGlobPattern(String pattern) Class constructor that create aGlobPatternwith the given pattern.GlobPattern(String pattern, boolean isHandle) Class constructor that create aGlobPatternwith the given pattern. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanReturnstrueif the string contains wildcards.booleanReturnstrueifthisGlobPatternis equal to objectobj.inthashCode()Returns the hashCode for thisGlobPattern.static intReturns the index of the first wildcard character in the string or-1if the string does not contain a wild card character.final booleanReturns a flag indicating whether a string matches this pattern.static booleanReturns a flag indicating whether a string matches a pattern.static booleanReturns a flag indicating whether a string matches a pattern.booleanReturns a flag indicating whether a string matches a pattern.booleanshellMatches(String s, char c) Returns a flag indicating whether a string matches a pattern.toString()Returns the pattern of thisGlobPattern
-
Constructor Details
-
GlobPattern
Class constructor that create aGlobPatternwith the given pattern. If theisHandleflag istruethis will construct a hierarchy matcher.- Parameters:
pattern- pattern stringisHandle- iftrueand the pattern contains no wildcards, thematches(String)returns true, if the compared string is equal or starts with the pattern+"/" (i.e. is a child page)
-
GlobPattern
Class constructor that create aGlobPatternwith the given pattern.- Parameters:
pattern- pattern string
-
-
Method Details
-
matches
Returns a flag indicating whether a string matches this pattern.- Parameters:
s- string to be checked- Returns:
trueif s matches this pattern, elsefalse.
-
matches
Returns a flag indicating whether a string matches a pattern.- Parameters:
pattern- pattern used for comparisons- string to be checked- Returns:
trueif s matches pattern, elsefalse.
-
matches
Returns a flag indicating whether a string matches a pattern. if the ishHandle istrueand the pattern contains no wildcards, the method returns true, if the pattern is a hierarchical father of the string.- Parameters:
pattern- pattern used for comparisons- string to be checkedisHandle- flag, indicating, if a handle comparison has to be performed- Returns:
trueif s matches pattern, elsefalse.
-
shellMatches
Returns a flag indicating whether a string matches a pattern. unlike thematchesmethods, this matching is done shell-like.- Parameters:
s- string to be checked- Returns:
trueif the string matches shell-like;falseotherwise.
-
shellMatches
Returns a flag indicating whether a string matches a pattern. unlike thematchesmethods, this matching is done shell-like.- Parameters:
s- string to be checkedc- character to be used as path delimiter- Returns:
trueif the string matches shell-like;falseotherwise.
-
containsWildcards
Returnstrueif the string contains wildcards.- Parameters:
s- string to be checked- Returns:
trueif s contains wildcards, elsefalse.
-
indexOfWildcard
Returns the index of the first wildcard character in the string or-1if the string does not contain a wild card character.- Parameters:
s- string to be checked- Returns:
- the index of the first wildcard.
-
toString
Returns the pattern of thisGlobPattern -
equals
ReturnstrueifthisGlobPatternis equal to objectobj. -
hashCode
public int hashCode()Returns the hashCode for thisGlobPattern.
-