public abstract class MatchArg extends Object
For example, given a the following User bean:
public class User { private String userName; private String password; private String firstName; private String lastName; public String getUserName() { return userName; } public String getPassword() { return password; } public String getFirstName() { return firstName; } public String getLastName() { return lastName; } public void setUserName(String s) { userName = s; } public void setPassword(String s) { password = s; } public void setFirstName(String s) { firstName = s; } public void setLastName(String s) { lastName = s; } }
this call would return all users with password equal to "testing".:
User[] array = dao.match(MatchArg.equals("password", "testing"));
Modifier | Constructor and Description |
---|---|
protected |
MatchArg() |
Modifier and Type | Method and Description |
---|---|
static MatchArg |
and(MatchArg... constraints)
Logical AND operator for use with the GenericDAO.match() method.
|
static MatchArg |
contains(String fieldName,
String s)
String "contains" operator for use with the
GenericDAO.match() method.
|
static MatchArg |
containsIgnoreCase(String fieldName,
String s)
String "contains" operator for use with the
GenericDAO.match() method.
|
static MatchArg |
endsWith(String fieldName,
String ending)
String "ends with" operator for use with the
GenericDAO.match() method.
|
static MatchArg |
endsWithIgnoreCase(String fieldName,
String ending)
String "ends with" operator for use with the
GenericDAO.match() method.
|
static MatchArg |
equals(String fieldName,
Object matchValue)
Equals operator for use with the GenericDAO.match() method.
|
static MatchArg |
equalsIgnoreCase(String keyName,
String matchValue) |
protected abstract org.genericdao.impl.matcharg.MatchOp |
getOp() |
static MatchArg |
greaterThan(String keyName,
Object matchValue) |
static MatchArg |
greaterThanOrEqualTo(String keyName,
Object matchValue) |
static MatchArg |
lessThan(String keyName,
Object matchValue) |
static MatchArg |
lessThanOrEqualTo(String keyName,
Object matchValue) |
static MatchArg |
max(String keyName) |
static MatchArg |
min(String keyName) |
static MatchArg |
notEquals(String fieldName,
Object matchValue)
Not equals operator for use with the GenericDAO.match() method.
|
static MatchArg |
or(MatchArg... constraints)
Logical OR operator for use with the GenericDAO.match() method.
|
static MatchArg |
startsWith(String keyName,
String beginning) |
static MatchArg |
startsWithIgnoreCase(String keyName,
String beginning) |
protected abstract org.genericdao.impl.matcharg.MatchOp getOp()
public static MatchArg and(MatchArg... constraints)
User[] array = dao.match(MatchArg.and(MatchArg.equals("firstName", "George"), MatchArg.equals("lastName", "Bush")));
constraints
- zero or more other MatchArg parameterspublic static MatchArg contains(String fieldName, String s)
For example, using the User bean defined above, this match would return all users whose first name contains a lower case double "r":
User[] array = dao.match(MatchArg.contains("firstName", "rr"));
fieldName
- the name of the field in the table being matched. Field must
contain string values.s
- the substring which must be present in the specified field for
this MatchArg to evaluate to true.public static MatchArg containsIgnoreCase(String fieldName, String s)
For example, using the User bean defined above, this match would return all users whose first name contains the substring "st", "sT", "St", or "ST":
User[] array = dao.match(MatchArg.containsIgnoreCase("firstName", "st"));
fieldName
- the name of the field in the table being matched. Field must
contain string values.s
- the substring which must be present in the specified field,
ignoring case, for this MatchArg to evaluate to true.public static MatchArg endsWith(String fieldName, String ending)
For example, using the User bean defined above, this match would return all users whose first name ends with the lower case "st" characters:
User[] array = dao.match(MatchArg.endsWith("firstName", "st"));
fieldName
- the name of the field in the table being matched. Field must
contain string values.ending
- the substring which must be present at the end of the
specified field for this MatchArg to evaluate to
true.public static MatchArg endsWithIgnoreCase(String fieldName, String ending)
For example, using the User bean defined above, this match would return all users whose first name contains the "st", "sT", "St", or "ST":
User[] array = dao.match(MatchArg.endsWithIgnoreCase("firstName", "st"));
fieldName
- the name of the field in the table being matched. Field must
contain string values.ending
- the substring which must be present at the end of the
specified field, ignoring case, for this MatchArg to
evaluate to true.public static MatchArg equals(String fieldName, Object matchValue)
For example, using the User bean defined above, this match would return all users whose friend count is zero:
User[] array = dao.match(MatchArg.equals("friendCount", 0));
fieldName
- the name of the field being matched.matchValue
- the value which the specified field must equal for this
MatchArg to evaluate to true.public static MatchArg notEquals(String fieldName, Object matchValue)
For example, using the User bean defined above, this match would return all users whose friend count not zero:
User[] array = dao.match(MatchArg.notEquals("friendCount", 0));
fieldName
- the name of the field being matched.matchValue
- the value which the specified field must not equal for this
MatchArg to evaluate to true.public static MatchArg or(MatchArg... constraints)
User[] array = dao.match( MatchArg.or( MatchArg.equals("firstName", "William"), MatchArg.equals("firstName", "Bill"));
constraints
- zero or more other MatchArg parametersCopyright © 2012-2016 Jeffrey L. Eppinger. All rights reserved. Permission granted for educational use only.