public class Utilities extends Object
Modifier and Type | Field and Description |
---|---|
static LikePatternSymbol |
A |
static LikePatternSymbol |
E |
static int |
EQ |
static LikePatternSymbol |
F |
static int |
GT |
static int |
GTE |
static int |
LT |
static int |
LTE |
static LikePatternSymbol |
N |
Constructor and Description |
---|
Utilities() |
Modifier and Type | Method and Description |
---|---|
static int |
compare(Object o1,
Object o2) |
static Object[] |
convertArgs(Object[] args,
Class[] argTypes) |
static String |
formatSignature(String name,
Class[] ps) |
static double |
getDouble(Object o) |
static Double |
getDoubleObject(Object o) |
static int |
getLastMatch(String value,
String search,
int start) |
static List |
getLikePattern(String value,
String wildcard) |
static void |
getMethods(Class c,
String name,
int mods,
List ms) |
static Class |
getObjectClass(Class c) |
static Class |
getPrimitiveClass(Class c) |
static boolean |
getResult(boolean v,
boolean n) |
static boolean |
isEquals(Object o1,
Object o2) |
static boolean |
isGTEquals(Object o1,
Object o2) |
static boolean |
isLTEquals(Object o1,
Object o2) |
static boolean |
isNumber(Class c) |
static boolean |
isNumber(Object o) |
static boolean |
isPrimitiveClass(Class c) |
static boolean |
matches(Object l,
Object r,
boolean ignoreCase,
int type,
boolean not)
This method encapsulates our "matching" mechanism.
|
static boolean |
matchLikePattern(List p,
Collection lhs,
boolean not,
boolean ignoreCase) |
static boolean |
matchLikePattern(List p,
Object o,
boolean ignoreCase) |
static boolean |
matchLikePattern(List p,
Object lhs,
boolean not,
boolean ignoreCase) |
static boolean |
matchLikePattern(List p,
String value) |
static boolean |
matchLikePattern(List p,
String value,
boolean not) |
static int |
matchMethodArgs(Class[] args,
Class[] compArgs) |
static void |
setObjectComparator(Comparator c) |
static String |
stripQuotes(String s) |
static String |
unescapeString(String v) |
public static LikePatternSymbol F
public static LikePatternSymbol A
public static LikePatternSymbol E
public static LikePatternSymbol N
public static final int GT
public static final int GTE
public static final int LT
public static final int LTE
public static final int EQ
public static void setObjectComparator(Comparator c)
public static boolean isPrimitiveClass(Class c)
public static boolean getResult(boolean v, boolean n)
public static boolean matches(Object l, Object r, boolean ignoreCase, int type, boolean not)
String.toString()
method of each object. In general this is not a problem
but beware of potential gotchas such as:
SELECT *
FROM MyObject
WHERE 20 >= (SELECT value
FROM myList)
It's tempting to think here that the query will return the correct result, however this is
NOT true because the sub-query will return a List of Lists (with "value" as the single
item in each list of the sub-query results). To make the query above work as expected you
should use:
SELECT *
FROM MyObject
// The value will be returned instead of an enclosing list.
WHERE 20 >= (SELECT [*] value
FROM myList)
l
- The LHS object.r
- The RHS object.ignoreCase
- Whether to ignore the case or not, note: setting this to true
will force a string comparison (the object to compare against will be
converted to a string via: String.toString()
and then "lowered".type
- The type of comparison to make, should be one of:
GT
, GTE
, LT
LTE
, EQ
.not
- Whether the result should be reversed.true
if l matches r given the rules defined by the
other parms, false
otherwise.public static double getDouble(Object o)
public static boolean isNumber(Object o)
public static boolean isNumber(Class c)
public static boolean matchLikePattern(List p, Object lhs, boolean not, boolean ignoreCase)
public static boolean matchLikePattern(List p, Collection lhs, boolean not, boolean ignoreCase)