public class GlobPattern
extends java.lang.Object
GlobPattern
implements matching operations that do a
pattern globbing.
day-commons-text
and should not
be used anymore. switch to regexp patterns if possible.Constructor and Description |
---|
GlobPattern(java.lang.String pattern)
Class constructor that create a
GlobPattern with the given
pattern. |
GlobPattern(java.lang.String pattern,
boolean isHandle)
Class constructor that create a
GlobPattern with the given
pattern. |
Modifier and Type | Method and Description |
---|---|
static boolean |
containsWildcards(java.lang.String s)
Returns
true if the string contains wildcards. |
boolean |
equals(java.lang.Object obj)
Returns
true if this GlobPattern
is equal to object obj . |
int |
hashCode()
Returns the hashCode for this
GlobPattern . |
static int |
indexOfWildcard(java.lang.String s)
Returns the index of the first wildcard character in the string or
-1 if the string does not contain a wild card character. |
boolean |
matches(java.lang.String s)
Returns a flag indicating whether a string matches this pattern.
|
static boolean |
matches(java.lang.String pattern,
java.lang.String s)
Returns a flag indicating whether a string matches a pattern.
|
static boolean |
matches(java.lang.String pattern,
java.lang.String s,
boolean isHandle)
Returns a flag indicating whether a string matches a pattern.
|
boolean |
shellMatches(java.lang.String s)
Returns a flag indicating whether a string matches a pattern.
|
boolean |
shellMatches(java.lang.String s,
char c)
Returns a flag indicating whether a string matches a pattern.
|
java.lang.String |
toString()
Returns the pattern of this
GlobPattern |
public GlobPattern(java.lang.String pattern, boolean isHandle)
GlobPattern
with the given
pattern. If the isHandle
flag is true
this
will construct a hierarchy matcher.pattern
- pattern stringisHandle
- if true
and the pattern contains no
wildcards, the matches(String)
returns true, if
the compared string is equal or starts with the
pattern+"/" (i.e. is a child page)public GlobPattern(java.lang.String pattern)
GlobPattern
with the given
pattern.pattern
- pattern stringpublic final boolean matches(java.lang.String s)
s
- string to be checkedtrue
if s matches this pattern, else
false
.public static boolean matches(java.lang.String pattern, java.lang.String s)
pattern
- pattern used for comparisons
- string to be checkedtrue
if s matches pattern,
else false
.public static boolean matches(java.lang.String pattern, java.lang.String s, boolean isHandle)
true
and the pattern contains
no wildcards, the method returns true, if the pattern is a hierarchical
father of the string.pattern
- pattern used for comparisons
- string to be checkedisHandle
- flag, indicating, if a handle comparison has to be
performedtrue
if s matches pattern,
else false
.public boolean shellMatches(java.lang.String s)
matches
methods, this matching is done shell-like.s
- string to be checkedtrue
if the string matches shell-like;
false
otherwise.public boolean shellMatches(java.lang.String s, char c)
matches
methods, this matching is done shell-like.s
- string to be checkedc
- character to be used as path delimitertrue
if the string matches shell-like;
false
otherwise.public static boolean containsWildcards(java.lang.String s)
true
if the string contains wildcards.s
- string to be checkedtrue
if s contains wildcards, else
false
.public static int indexOfWildcard(java.lang.String s)
-1
if the string does not contain a wild card character.s
- string to be checkedpublic java.lang.String toString()
GlobPattern
toString
in class java.lang.Object
public boolean equals(java.lang.Object obj)
true
if this
GlobPattern
is equal to object obj
.equals
in class java.lang.Object
obj
- the object to compare for equality.true
if this
GlobPattern
is equal to object obj
.public int hashCode()
GlobPattern
.hashCode
in class java.lang.Object
GlobPattern
."Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"