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

📄 criteria.java

📁 torque服务器源代码
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                        {                            isEquiv = false;                            break;                        }                    }                    else                    {                        isEquiv = false;                        break;                    }                }            }        }        return isEquiv;    }    /*     *------------------------------------------------------------------------     *     * Start of the "and" methods     *     *------------------------------------------------------------------------     */    /**     * This method adds a prepared Criterion object to the Criteria as a having     * clause. You can get a new, empty Criterion object with the     * getNewCriterion() method.     *     * <p>     * <code>     * Criteria crit = new Criteria();     * Criteria.Criterion c = crit.getNewCriterion(BasePeer.ID, new Integer(5),     *         Criteria.LESS_THAN);     * crit.addHaving(c);     * </code>     *     * @param having A Criterion object     * @return A modified Criteria object.     */    public Criteria addHaving(Criterion having)    {        this.having = having;        return this;    }    /**     * This method adds a prepared Criterion object to the Criteria.     * You can get a new, empty Criterion object with the     * getNewCriterion() method. If a criterion for the requested column     * already exists, it is "AND"ed to the existing criterion.     * This is used as follows:     *     * <p>     * <code>     * Criteria crit = new Criteria();     * Criteria.Criterion c = crit.getNewCriterion(BasePeer.ID, new Integer(5),     *         Criteria.LESS_THAN);     * crit.and(c);     * </code>     *     * @param c A Criterion object     * @return A modified Criteria object.     */    public Criteria and(Criterion c)    {        Criterion oc = getCriterion(c.getTable() + '.' + c.getColumn());        if (oc == null)        {            add(c);        }        else        {            oc.and(c);        }        return this;    }    /**     * This method adds a new criterion to the list of criterias. If a     * criterion for the requested column already exists, it is     * "AND"ed to the existing criterion. This is used as follows:     *     * <p>     * <code>     * Criteria crit = new Criteria().and(&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 and(table, column, value) method.     *     * @param column The column to run the comparison on     * @param value An Object.     *     * @return A modified Criteria object.     */    public Criteria and(String column, Object value)    {        and(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     * "AND"ed to the existing criterion. If is used as follow:     *     * <p>     * <code>     * Criteria crit = new Criteria().and(&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 and(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 and(String column, Object value, SqlEnum comparison)    {        Criterion oc = getCriterion(column);        Criterion nc = new Criterion(column, value, comparison);        if (oc == null)        {            super.put(column, nc);        }        else        {            oc.and(nc);        }        return this;    }    /**     * This method adds a new criterion to the list of criterias.     * If a criterion for the requested column already exists, it is     * "AND"ed to the existing criterion. If is used as follows:     *     * <p>     * <code>     * Criteria crit = new Criteria().and(&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 and(String table, String column, Object value)    {        and(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     * "AND"ed to the existing criterion. If is used as follows:     *     * <p>     * <code>     * Criteria crit = new Criteria().and(&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 and(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);        Criterion oc = getCriterion(table, column);        Criterion nc = new Criterion(table, column, value, comparison);        if (oc == null)        {            super.put(sb.toString(), nc);        }        else        {            oc.and(nc);        }        return this;    }    /**     * Convenience method to add a boolean to Criteria.     * Equal to     *     * <p>     * <code>     * and(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 and(String column, boolean value)    {        and(column, new Boolean(value));        return this;    }    /**     * Convenience method to add a boolean to Criteria.     * Equal to     *     * <p>     * <code>     * and(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 and(String column, boolean value, SqlEnum comparison)    {        and(column, new Boolean(value), comparison);        return this;    }    /**     * Convenience method to add an int to Criteria.     * Equal to     *     * <p>     * <code>     * and(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 and(String column, int value)    {        and(column, new Integer(value));        return this;    }    /**     * Convenience method to add an int to Criteria.     * Equal to     *     * <p>     * <code>     * and(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 and(String column, int value, SqlEnum comparison)    {        and(column, new Integer(value), comparison);        return this;    }    /**     * Convenience method to add a long to Criteria.     * Equal to     *     * <p>     * <code>     * and(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 and(String column, long value)    {        and(column, new Long(value));        return this;    }    /**     * Convenience method to add a long to Criteria.     * Equal to     *     * <p>     * <code>     * and(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 and(String column, long value, SqlEnum comparison)    {        and(column, new Long(value), comparison);        return this;    }    /**     * Convenience method to add a float to Criteria.     * Equal to     *     * <p>     * <code>     * and(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 and(String column, float value)    {        and(column, new Float(value));        return this;    }    /**     * Convenience method to add a float to Criteria.     * Equal to     *     * <p>     * <code>     * and(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 and(String column, float value, SqlEnum comparison)    {        and(column, new Float(value), comparison);        return this;    }    /**     * Convenience method to add a double to Criteria.     * Equal to     *     * <p>     * <code>     * and(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 and(String column, double value)    {        and(column, new Double(value));        return this;    }    /**     * Convenience method to add a double to Criteria.     * Equal to     *     * <p>     * <code>     * and(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 and(String column, double value, SqlEnum comparison)    {        and(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>     * and(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.     * @param date An int with the date.     * @return A modified Criteria object.     */    public Criteria andDate(String column, int year, int month, int date)    {        and(column, new GregorianCalendar(year, month, date));        return this;    }    /**     * Convenience method to add a Date object specified by     * year, month, and date into the Criteria.     * Equal to     *     * <p>     * <code>     * and(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.     * @param date An int with the date.     * @param comparison String describing how to compare the column with     *        the value     * @return A mo

⌨️ 快捷键说明

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