/** * Create a new Filter using the > operator. */ public static Filter greaterThan(String property, Object value) { return new Filter(property, value, OP_GREATER_THAN); }
/** * Create a new Filter using the <= operator. */ public static Filter lessOrEqual(String property, Object value) { return new Filter(property, value, OP_LESS_OR_EQUAL); }
/** * Create a new Filter using the NOT operator. */ public static Filter not(Filter filter) { return new Filter("NOT", filter, OP_NOT); }
/** * Create a new Filter using the NONE operator. This is equivalent to NOT * SOME. */ public static Filter none(String property, Filter filter) { return new Filter(property, filter, OP_NONE); }
/** * Create a new Filter using the IN operator. * * <p> * This takes a variable number of parameters. Any number of values can be * specified. */ public static Filter in(String property, Collection<?> value) { return new Filter(property, value, OP_IN); }
/** * Create a new Filter using the ILIKE operator. */ public static Filter ilike(String property, String value) { return new Filter(property, value, OP_ILIKE); }
/** * 添加对between操作符的支持 * @param property * @param beginValue * @param endValue * @return */ public static Filter between(String property,Object beginValue,Object endValue) { return new Filter(property,beginValue,endValue,OP_BETWEEN); }
/** * Create a new Filter using the < operator. */ public static Filter lessThan(String property, Object value) { return new Filter(property, value, OP_LESS_THAN); }
/** * Create a new Filter using the NOT IN operator. * * <p> * This takes a variable number of parameters. Any number of values can be * specified. */ public static Filter notIn(String property, Object... value) { return new Filter(property, value, OP_NOT_IN); }
/** * Create a new Filter using the IS NOT NULL operator. */ public static Filter isNotNull(String property) { return new Filter(property, true, OP_NOT_NULL); }
/** * Create a new Filter using the IS EMPTY operator. */ public static Filter isEmpty(String property) { return new Filter(property, true, OP_EMPTY); }
/** * Create a new Filter using the IS NOT EMPTY operator. */ public static Filter isNotEmpty(String property) { return new Filter(property, true, OP_NOT_EMPTY); }
/** * Create a new Filter using the == operator. */ public static Filter equal(String property, Object value) { return new Filter(property, value, OP_EQUAL); }
/** * Create a new Filter using the >= operator. */ public static Filter greaterOrEqual(String property, Object value) { return new Filter(property, value, OP_GREATER_OR_EQUAL); }
/** * Create a new Filter using the IN operator. * * <p> * This takes a variable number of parameters. Any number of values can be * specified. */ public static Filter in(String property, Object... value) { return new Filter(property, value, OP_IN); }
/** * Create a new Filter using the IS NULL operator. */ public static Filter isNull(String property) { return new Filter(property, true, OP_NULL); }
/** * Create a new Filter using the SOME operator. */ public static Filter some(String property, Filter filter) { return new Filter(property, filter, OP_SOME); }
/** * Create a new Filter using the ALL operator. */ public static Filter all(String property, Filter filter) { return new Filter(property, filter, OP_ALL); }
public GSUser searchByName(String name) { Search search = new Search(); search.addFilter(new Filter("username", name)); List<GSUser> users = search(search); if(users.isEmpty()) return null; else if(users.size() > 1) throw new IllegalArgumentException("Given filter ("+name+") returns too many users ("+users.size()+")"); GSUser user = users.get(0); return user; }
public GSUser searchByName(String name) { Search search = new Search(); search.addFilter(new Filter("username", name)); List<GSUser> users = search(search); if(users.isEmpty()) return null; else if(users.size() > 1) throw new IllegalArgumentException("Given filter ("+name+") returns too many users ("+users.size()+")"); GSUser user = users.get(0); return user; }