⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 criteria.java

📁 torque服务器源代码
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
            Map.Entry e = (Map.Entry) i.next();            Object val = e.getValue();            if (val instanceof Criteria.Criterion)            {                super.put(e.getKey(), val);            }            else            {                put(e.getKey(), val);            }        }        if (t instanceof Criteria)        {            Criteria c = (Criteria) t;            this.joinL = c.joinL;            this.joinR = c.joinR;        }        /* this would make a copy, not included           but might want to use some of it.        if (t instanceof Criteria)        {            Criteria c = (Criteria)t;            this.ignoreCase = c.ignoreCase;            this.singleRecord = c.singleRecord;            this.cascade = c.cascade;            this.selectModifiers = c.selectModifiers;            this.selectColumns = c.selectColumns;            this.orderByColumns = c.orderByColumns;            this.dbName = c.dbName;            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(&quot;column&quot;,     *                                      &quot;value&quot;);     * </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(&quot;column&quot;,     *                                      &quot;value&quot;     *                                      &quot;Criterion.GREATER_THAN&quot;);     * </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(&quot;table&quot;,     *                                      &quot;column&quot;,     *                                      &quot;value&quot;);     * </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(&quot;table&quot;,     *                                      &quot;column&quot;,     *                                      &quot;value&quot;,     *                                      &quot;Criterion.GREATER_THAN&quot;);     * </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)    {        if (joinL == null)        {            joinL = new ArrayList(3);            joinR = new ArrayList(3);        }        joinL.add(left);        joinR.add(right);        return this;    }    /**     * get one side of the set of possible joins.  This method is meant to     * be called by BasePeer.     */    public List getJoinL()    {        return joinL;    }    /**     * get one side of the set of possible joins.  This method is meant to     * be called by BasePeer.     */    public List getJoinR()    {        return joinR;    }    /**

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -