|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object tribble.util.SQLPattern
public class SQLPattern
SQL 'LIKE' pattern matching operator.
This class provides methods that compare patterns to strings in the manner of the SQL 'LIKE' operator. Specifically, the SQL LIKE operator takes two operands, a pattern string and a value string, and determines if the value string matches the pattern.
The LIKE pattern string is composed of regular characters and wildcard characters. Regular characters must match exactly. The wildcard character '_' matches any single character, and the wildcard character '%' matches zero or more characters.
The matches(String)
method is used to match an SQL pattern against a
string.
A static matches(String, String)
method is also provided for
convenience.
FilenamePattern
Field Summary | |
---|---|
protected FilenamePattern |
m_pat
SQL 'LIKE' pattern matcher. |
static char |
PAT_ANY
Default pattern character: Any single character. |
static char |
PAT_CLOSURE
Default pattern character: Zero or more characters. |
static char |
PAT_ESCAPE
Default pattern character: Escape any special meaning. |
Constructor Summary | |
---|---|
SQLPattern(java.lang.String pat)
Constructor. |
Method Summary | |
---|---|
boolean |
matches(java.lang.String s)
Determine if a string matches the SQL pattern. |
static boolean |
matches(java.lang.String pat,
java.lang.String s)
Determine if a string matches an SQL pattern. |
static boolean |
matchSQLPattern(java.lang.String pat,
java.lang.String s)
Determine if a string matches a pattern string. |
boolean |
setIgnoreCase(boolean flag)
Establish whether or not the SQL pattern matcher ignores case. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final char PAT_ESCAPE
public static final char PAT_ANY
public static final char PAT_CLOSURE
protected FilenamePattern m_pat
Constructor Detail |
---|
public SQLPattern(java.lang.String pat)
pat
- An SQL 'LIKE' pattern.
java.lang.IllegalArgumentException
- (unchecked)
Thrown if pat is malformed.
java.lang.NullPointerException
- (unchecked)
Thrown if pat is null.Method Detail |
---|
public static boolean matches(java.lang.String pat, java.lang.String s)
pat
- An SQL pattern string.s
- A string to compare against pat.
java.lang.IllegalArgumentException
- (unchecked)
Thrown if pat is malformed.
java.lang.NullPointerException
- (unchecked)
Thrown if pat or s is null.public static boolean matchSQLPattern(java.lang.String pat, java.lang.String s)
pat
- A pattern string.
A pattern is composed of regular characters and
special pattern matching characters, which are:
s
- A string to compare against pattern pat.
public boolean setIgnoreCase(boolean flag)
flag
- If true, upper and lower case letters are considered to be identical when
matching strings (e.g., strings "abc", "Abc", and
"ABC" will all be considered to be the same).
If false, the pattern matcher is case-sensitive, and equivalent upper and
lower case letters are considered to be different.
public boolean matches(java.lang.String s)
s
- A string to match against the SQL pattern.
java.lang.NullPointerException
- (unchecked)
Thrown if s is null.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |