?? criteria.java
字號:
this.limit = c.limit; this.offset = c.offset; this.aliases = c.aliases; } */ } /** * This method adds a new criterion to the list of criterias. If a * criterion for the requested column already exists, it is * replaced. This is used as follows: * * <p> * <code> * Criteria crit = new Criteria().add("column", * "value"); * </code> * * An EQUAL comparison is used for column and value. * * The name of the table must be used implicitly in the column name, * so the Column name must be something like 'TABLE.id'. If you * don't like this, you can use the add(table, column, value) method. * * @param column The column to run the comparison on * @param value An Object. * * @return A modified Criteria object. */ public Criteria add (String column, Object value) { add(column, value, EQUAL); return this; } /** * This method adds a new criterion to the list of criterias. * If a criterion for the requested column already exists, it is * replaced. If is used as follow: * * <p> * <code> * Criteria crit = new Criteria().add("column", * "value" * "Criterion.GREATER_THAN"); * </code> * * Any comparison can be used. * * The name of the table must be used implicitly in the column name, * so the Column name must be something like 'TABLE.id'. If you * don't like this, you can use the add(table, column, value) method. * * @param column The column to run the comparison on * @param value An Object. * @param comparison A String. * * @return A modified Criteria object. */ public Criteria add(String column, Object value, SqlEnum comparison) { super.put(column, new Criterion(column, value, comparison)); return this; } /** * This method adds a new criterion to the list of criterias. * If a criterion for the requested column already exists, it is * replaced. If is used as follows: * * <p> * <code> * Criteria crit = new Criteria().add("table", * "column", * "value"); * </code> * * An EQUAL comparison is used for column and value. * * @param table Name of the table which contains the column * @param column The column to run the comparison on * @param value An Object. * * @return A modified Criteria object. */ public Criteria add(String table, String column, Object value) { add(table, column, value, EQUAL); return this; } /** * This method adds a new criterion to the list of criterias. * If a criterion for the requested column already exists, it is * replaced. If is used as follows: * * <p> * <code> * Criteria crit = new Criteria().add("table", * "column", * "value", * "Criterion.GREATER_THAN"); * </code> * * Any comparison can be used. * * @param table Name of table which contains the column * @param column The column to run the comparison on * @param value An Object. * @param comparison String describing how to compare the column with * the value * @return A modified Criteria object. */ public Criteria add(String table, String column, Object value, SqlEnum comparison) { StringBuffer sb = new StringBuffer(table.length() + column.length() + 1); sb.append(table); sb.append('.'); sb.append(column); super.put(sb.toString(), new Criterion(table, column, value, comparison)); return this; } /** * Convenience method to add a boolean to Criteria. * Equal to * * <p> * <code> * add(column, new Boolean(value), EQUAL); * </code> * * @param column The column to run the comparison on * @param value A Boolean. * * @return A modified Criteria object. */ public Criteria add(String column, boolean value) { add(column, (value ? Boolean.TRUE : Boolean.FALSE)); return this; } /** * Convenience method to add a boolean to Criteria. * Equal to * * <p> * <code> * add(column, new Boolean(value), comparison); * </code> * * @param column The column to run the comparison on * @param value A Boolean. * @param comparison String describing how to compare the column with * the value * @return A modified Criteria object. */ public Criteria add(String column, boolean value, SqlEnum comparison) { add(column, new Boolean(value), comparison); return this; } /** * Convenience method to add an int to Criteria. * Equal to * * <p> * <code> * add(column, new Integer(value), EQUAL); * </code> * * @param column The column to run the comparison on * @param value An int. * @return A modified Criteria object. */ public Criteria add(String column, int value) { add(column, new Integer(value)); return this; } /** * Convenience method to add an int to Criteria. * Equal to * * <p> * <code> * add(column, new Integer(value), comparison); * </code> * * @param column The column to run the comparison on * @param value An int. * @param comparison String describing how to compare the column with * the value * @return A modified Criteria object. */ public Criteria add(String column, int value, SqlEnum comparison) { add(column, new Integer(value), comparison); return this; } /** * Convenience method to add a long to Criteria. * Equal to * * <p> * <code> * add(column, new Long(value), EQUAL); * </code> * * @param column The column to run the comparison on * @param value A long. * @return A modified Criteria object. */ public Criteria add(String column, long value) { add(column, new Long(value)); return this; } /** * Convenience method to add a long to Criteria. * Equal to * * <p> * <code> * add(column, new Long(value), comparison); * </code> * * @param column The column to run the comparison on * @param value A long. * @param comparison String describing how to compare the column with * the value * @return A modified Criteria object. */ public Criteria add(String column, long value, SqlEnum comparison) { add(column, new Long(value), comparison); return this; } /** * Convenience method to add a float to Criteria. * Equal to * * <p> * <code> * add(column, new Float(value), EQUAL); * </code> * * @param column The column to run the comparison on * @param value A float. * @return A modified Criteria object. */ public Criteria add(String column, float value) { add(column, new Float(value)); return this; } /** * Convenience method to add a float to Criteria. * Equal to * * <p> * <code> * add(column, new Float(value), comparison); * </code> * * @param column The column to run the comparison on * @param value A float. * @param comparison String describing how to compare the column with * the value * @return A modified Criteria object. */ public Criteria add(String column, float value, SqlEnum comparison) { add(column, new Float(value), comparison); return this; } /** * Convenience method to add a double to Criteria. * Equal to * * <p> * <code> * add(column, new Double(value), EQUAL); * </code> * * @param column The column to run the comparison on * @param value A double. * @return A modified Criteria object. */ public Criteria add(String column, double value) { add(column, new Double(value)); return this; } /** * Convenience method to add a double to Criteria. * Equal to * * <p> * <code> * add(column, new Double(value), comparison); * </code> * * @param column The column to run the comparison on * @param value A double. * @param comparison String describing how to compare the column with * the value * @return A modified Criteria object. */ public Criteria add(String column, double value, SqlEnum comparison) { add(column, new Double(value), comparison); return this; } /** * Convenience method to add a Date object specified by * year, month, and date into the Criteria. * Equal to * * <p> * <code> * add(column, new GregorianCalendar(year, month,date), EQUAL); * </code> * * @param column A String value to use as column. * @param year An int with the year. * @param month An int with the month. Month value is 0-based. * e.g., 0 for January * @param date An int with the date. * @return A modified Criteria object. */ public Criteria addDate(String column, int year, int month, int date) { add(column, new GregorianCalendar(year, month, date).getTime()); return this; } /** * Convenience method to add a Date object specified by * year, month, and date into the Criteria. * Equal to * * <p> * <code> * add(column, new GregorianCalendar(year, month,date), comparison); * </code> * * @param column The column to run the comparison on * @param year An int with the year. * @param month An int with the month. Month value is 0-based. * e.g., 0 for January * @param date An int with the date. * @param comparison String describing how to compare the column with * the value * @return A modified Criteria object. */ public Criteria addDate(String column, int year, int month, int date, SqlEnum comparison) { add(column, new GregorianCalendar(year, month, date).getTime(), comparison); return this; } /** * This is the way that you should add a join of two tables. For * example: * * <p> * AND PROJECT.PROJECT_ID=FOO.PROJECT_ID * <p> * * left = PROJECT.PROJECT_ID * right = FOO.PROJECT_ID * * @param left A String with the left side of the join. * @param right A String with the right side of the join. * @return A modified Criteria object. */ public Criteria addJoin(String left, String right) { return addJoin(left, right, null); } /** * This is the way that you should add a join of two tables. For * example: * * <p> * PROJECT LEFT JOIN FOO ON PROJECT.PROJECT_ID=FOO.PROJECT_ID * <p> * * left = "PROJECT.PROJECT_ID" * right = "FOO.PROJECT_ID" * operator = Criteria.LEFT_JOIN * * @param left A String with the left side of the join. * @param right A String with the right side of the join. * @param operator The operator used for the join: must be one of null, * Criteria.LEFT_JOIN, Criteria.RIGHT_JOIN, Criteria.INNER_JOIN * @return A modified Criteria object. */ public Criteria addJoin(String left, String right, SqlEnum operator) { if (joins == null) { joins = new ArrayList(3); } joins.add(new Join(left,right, operator)); return this; } /** * get the List of Joins. This method is meant to * be called by BasePeer. * @return a List which contains objects of type Join, * or null if the criteria dies not contains any joins */ public List getJoins() { return joins; } /** * get one side of the set of possible joins. This method is meant to * be called by BasePeer. * * @deprecated This method is no longer used by BasePeer. */ public List getJoinL() { throw new RuntimeException("getJoinL() in Criteria is no longer supported!"); } /** * get one side of the set of possible joins. This method is meant to * be called by BasePeer. * * @deprecated This method is no longer used by BasePeer. */ public List getJoinR()
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -