|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.sqlunit.MatchPattern
public class MatchPattern
MatchPattern fills a role in SQLUnit similar to Regular Expressions in text pattern matching. It is instantiated from the data supplied in the Match tag using the MatchHandler class. Unlike an user-defined object which implements the IMatcher interface, this class will not only know the algorithm to apply for matching (using the IMatcher object), but also where in the result object to apply the algorithm. The MatchHandler class builds a list of MatchPattern objects which is successively matched by DatabaseResult to determine whether to apply the pattern, and if so, return the results of the match. If no MatchPattern object is found to match against for the particular DatabaseResultKey, then the default matching (exact equality) is used. Multiple values may be specified as regular expression filters similar to that used in the Unix cut.
Constructor Summary | |
---|---|
MatchPattern(java.lang.String resultSetIdFilter,
java.lang.String rowIdFilter,
java.lang.String colIdFilter,
java.lang.String matcherClass,
java.util.Map args)
Builds a MatchPattern object with the supplied input parameters. |
Method Summary | |
---|---|
boolean |
applyMatcher(java.lang.String source,
java.lang.String target)
Returns true or false as a result of applying the matching algorithm specified by the IMatcher object. |
boolean |
canApply(int resultSetId,
int rowId,
int colId)
Returns true if this MatchPattern object can be applied to the DatabaseResult element specified by the [resultSetId, rowId, colId] tuple. |
java.lang.String |
getMatcherClass()
Returns the full name of the Matcher class invoked by this MatchPattern. |
static boolean |
matchPattern(java.lang.String p,
int s)
Matches a pattern filter against the supplied String s. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MatchPattern(java.lang.String resultSetIdFilter, java.lang.String rowIdFilter, java.lang.String colIdFilter, java.lang.String matcherClass, java.util.Map args)
resultSetIdFilter
- a regular expression.rowIdFilter
- a regular expression.colIdFilter
- a regular expression.matcherClass
- the full java class name of the IMatcher object.args
- a Map of name value pairs representing additional parameters
to the IMatcher object to determine matching.Method Detail |
---|
public final java.lang.String getMatcherClass()
public final boolean canApply(int resultSetId, int rowId, int colId) throws SQLUnitException
resultSetId
- the resultSet id.rowId
- the row id.colId
- the column id.
SQLUnitException
- if a regular expression was incorrect.public final boolean applyMatcher(java.lang.String source, java.lang.String target) throws SQLUnitException
source
- the source value of the DatabaseResult element.target
- the target value of the DatabaseResult element.
SQLUnitException
- if an underlying match operation failed.public static boolean matchPattern(java.lang.String p, int s) throws SQLUnitException
p
- the pattern filter to match against.s
- the integer id to match.
SQLUnitException
- if the pattern could not be parsed.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |