| java.lang.Object org.josql.internal.Utilities
Utilities | public class Utilities (Code) | | |
Field Summary | |
final public static int | EQ | final public static int | GT | final public static int | GTE | final public static int | LT | final public static int | LTE |
Method Summary | |
public static int | compare(Object o1, Object o2) | public static Object[] | convertArgs(Object[] args, Class[] argTypes) | public static String | formatSignature(String name, Class[] ps) | public static double | getDouble(Object o) | public static Double | getDoubleObject(Object o) | public static List | getLikePattern(String value, String wildcard) | public static void | getMethods(Class c, String name, int mods, List ms) | public static Class | getObjectClass(Class c) | public static Class | getPrimitiveClass(Class c) | public static boolean | getResult(boolean v, boolean n) | public static boolean | isEquals(Object o1, Object o2) | public static boolean | isGTEquals(Object o1, Object o2) | public static boolean | isLTEquals(Object o1, Object o2) | public static boolean | isNumber(Object o) | public static boolean | isNumber(Class c) | public static boolean | isPrimitiveClass(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) | public static boolean | matchLikePattern(List p, Object o, boolean ignoreCase) | public static boolean | matchLikePattern(List p, String value) | public static boolean | matchLikePattern(List p, String value, boolean not) | public static int | matchMethodArgs(Class[] args, Class[] compArgs) | public static boolean | matches(Object l, Object r, boolean ignoreCase, int type, boolean not) This method encapsulates our "matching" mechanism. | public static String | stripQuotes(String s) |
EQ | final public static int EQ(Code) | | |
GT | final public static int GT(Code) | | |
GTE | final public static int GTE(Code) | | |
LT | final public static int LT(Code) | | |
LTE | final public static int LTE(Code) | | |
getResult | public static boolean getResult(boolean v, boolean n)(Code) | | |
isPrimitiveClass | public static boolean isPrimitiveClass(Class c)(Code) | | |
matchLikePattern | public static boolean matchLikePattern(List p, Object lhs, boolean not, boolean ignoreCase)(Code) | | |
matchLikePattern | public static boolean matchLikePattern(List p, Collection lhs, boolean not, boolean ignoreCase)(Code) | | |
matchLikePattern | public static boolean matchLikePattern(List p, Object o, boolean ignoreCase)(Code) | | |
matchLikePattern | public static boolean matchLikePattern(List p, String value)(Code) | | |
matchLikePattern | public static boolean matchLikePattern(List p, String value, boolean not)(Code) | | |
matchMethodArgs | public static int matchMethodArgs(Class[] args, Class[] compArgs)(Code) | | |
matches | public static boolean matches(Object l, Object r, boolean ignoreCase, int type, boolean not)(Code) | | This method encapsulates our "matching" mechanism. It handles collections correctly
and will match according to the combination of igoreCase, type and
not.
Note: this method deliberately throws no exceptions, and it tries hard to ensure that
ClassCastExceptions and NullPointerExceptions are also NOT thrown, in other words in
theory it should be possible to compare ANY object against ANY other in safety. However
if the objects DO NOT implement comparable (and are type compatible, i.e. can r
be assigned to l) then a string comparison is performed so you may be at the mercy
of the
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)
Parameters: l - The LHS object. Parameters: r - The RHS object. Parameters: ignoreCase - Whether to ignore the case or not, note: setting this to true will force a string comparison (the object to compare against will beconverted to a string via: String.toString and then "lowered". Parameters: type - The type of comparison to make, should be one of:Utilities.GT, Utilities.GTE, Utilities.LTUtilities.LTE, Utilities.EQ. Parameters: not - Whether the result should be reversed. true if l matches r given the rules defined by the other parms, false otherwise. |
|
|