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

📄 criteria.java

📁 另外一种持久性o/m软件
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
    {        return getCriterion(name).getColumn();    }    /**     * Method to return a comparison String.     *     * @param key String name of the key.     * @return A String with the value of the object at key.     */    public SqlEnum getComparison(String key)    {        return getCriterion(key).getComparison();    }    /**     * Method to return a comparison String.     *     * @param table String name of table.     * @param column String name of column.     * @return A String with the value of the object at key.     */    public SqlEnum getComparison(String table, String column)    {        return getComparison(                new StringBuffer(table.length() + column.length() + 1)                .append(table).append('.').append(column)                .toString());    }    /**     * Convenience method to return a Date.     *     * @param name column name (TABLE.COLUMN)     * @return A java.util.Date with the value of object at key.     */    public java.util.Date getDate(String name)    {        return (java.util.Date) getCriterion(name).getValue();    }    /**     * Convenience method to return a Date.     *     * @param table String name of table.     * @param column String name of column.     * @return A java.util.Date with the value of object at key.     */    public java.util.Date getDate(String table, String column)    {        return getDate(                new StringBuffer(table.length() + column.length() + 1)                .append(table).append('.').append(column)                .toString());    }    /**     * Get the Database(Map) name.     *     * @return A String with the Database(Map) name.  By default, this     * is PoolBrokerService.DEFAULT.     */    public String getDbName()    {        return dbName;    }    /**     * Set the DatabaseMap name.  If <code>null</code> is supplied, uses value     * provided by <code>Torque.getDefaultDB()</code>.     *     * @param dbName A String with the Database(Map) name.     */    public void setDbName(String dbName)    {        this.dbName = (dbName == null ? Torque.getDefaultDB() : dbName.trim());    }    /**     * Convenience method to return a double.     *     * @param name A String with the name of the key.     * @return A double with the value of object at key.     */    public double getDouble(String name)    {        Object obj = getCriterion(name).getValue();        if (obj instanceof String)        {            return new Double((String) obj).doubleValue();        }        return ((Double) obj).doubleValue();    }    /**     * Convenience method to return a double.     *     * @param table String name of table.     * @param column String name of column.     * @return A double with the value of object at key.     */    public double getDouble(String table, String column)    {        return getDouble(new StringBuffer(table.length() + column.length() + 1)                .append(table).append('.').append(column)                .toString());    }    /**     * Convenience method to return a float.     *     * @param name A String with the name of the key.     * @return A float with the value of object at key.     */    public float getFloat(String name)    {        Object obj = getCriterion(name).getValue();        if (obj instanceof String)        {            return new Float((String) obj).floatValue();        }        return ((Float) obj).floatValue();    }    /**     * Convenience method to return a float.     *     * @param table String name of table.     * @param column String name of column.     * @return A float with the value of object at key.     */    public float getFloat(String table, String column)    {        return getFloat(new StringBuffer(table.length() + column.length() + 1)                .append(table).append('.').append(column)                .toString());    }    /**     * Convenience method to return an Integer.     *     * @param name A String with the name of the key.     * @return An Integer with the value of object at key.     */    public Integer getInteger(String name)    {        Object obj = getCriterion(name).getValue();        if (obj instanceof String)        {            return new Integer((String) obj);        }        return ((Integer) obj);    }    /**     * Convenience method to return an Integer.     *     * @param table String name of table.     * @param column String name of column.     * @return An Integer with the value of object at key.     */    public Integer getInteger(String table, String column)    {        return getInteger(                new StringBuffer(table.length() + column.length() + 1)                .append(table).append('.').append(column)                .toString());    }    /**     * Convenience method to return an int.     *     * @param name A String with the name of the key.     * @return An int with the value of object at key.     */    public int getInt(String name)    {        Object obj = getCriterion(name).getValue();        if (obj instanceof String)        {            return new Integer((String) obj).intValue();        }        return ((Integer) obj).intValue();    }    /**     * Convenience method to return an int.     *     * @param table String name of table.     * @param column String name of column.     * @return An int with the value of object at key.     */    public int getInt(String table, String column)    {        return getInt(                new StringBuffer(table.length() + column.length() + 1)                .append(table).append('.').append(column)                .toString());    }    /**     * Convenience method to return a BigDecimal.     *     * @param name A String with the name of the key.     * @return A BigDecimal with the value of object at key.     */    public BigDecimal getBigDecimal(String name)    {        Object obj = getCriterion(name).getValue();        if (obj instanceof String)        {            return new BigDecimal((String) obj);        }        return (BigDecimal) obj;    }    /**     * Convenience method to return a BigDecimal.     *     * @param table String name of table.     * @param column String name of column.     * @return A BigDecimal with the value of object at key.     */    public BigDecimal getBigDecimal(String table, String column)    {        return getBigDecimal(                new StringBuffer(table.length() + column.length() + 1)                .append(table).append('.').append(column)                .toString());    }    /**     * Convenience method to return a long.     *     * @param name A String with the name of the key.     * @return A long with the value of object at key.     */    public long getLong(String name)    {        Object obj = getCriterion(name).getValue();        if (obj instanceof String)        {            return new Long((String) obj).longValue();        }        return ((Long) obj).longValue();    }    /**     * Convenience method to return a long.     *     * @param table String name of table.     * @param column String name of column.     * @return A long with the value of object at key.     */    public long getLong(String table, String column)    {        return getLong(                new StringBuffer(table.length() + column.length() + 1)                .append(table).append('.').append(column)                .toString());    }    /**     * Convenience method to return a String.     *     * @param name A String with the name of the key.     * @return A String with the value of object at key.     */    public String getString(String name)    {        return (String) getCriterion(name).getValue();    }    /**     * Convenience method to return a String.     *     * @param table String name of table.     * @param column String name of column.     * @return A String with the value of object at key.     */    public String getString(String table, String column)    {        return getString(                new StringBuffer(table.length() + column.length() + 1)                .append(table).append('.').append(column)                .toString());    }    /**     * Method to return a String table name.     *     * @param name A String with the name of the key.     * @return A String with the value of object at key.     */    public String getTableName(String name)    {        return getCriterion(name).getTable();    }    /**     * Convenience method to return a List.     *     * @param name A String with the name of the key.     * @return A List with the value of object at key.     */    public List getList(String name)    {        return (List) getCriterion(name).getValue();    }    /**     * Convenience method to return a List.     *     * @param table String name of table.     * @param column String name of column.     * @return A List with the value of object at key.     */    public List getList(String table, String column)    {        return getList(                new StringBuffer(table.length() + column.length() + 1)                .append(table).append('.').append(column)                .toString());    }    /**     * Method to return the value that was added to Criteria.     *     * @param name A String with the name of the key.     * @return An Object with the value of object at key.     */    public Object getValue(String name)    {        return getCriterion(name).getValue();    }    /**     * Method to return the value that was added to Criteria.     *     * @param table String name of table.     * @param column String name of column.     * @return An Object with the value of object at key.     */    public Object getValue(String table, String column)    {        return getValue(                new StringBuffer(table.length() + column.length() + 1)                .append(table).append('.').append(column)                .toString());    }    /**     * Convenience method to return an ObjectKey.     *     * @param name A String with the name of the key.     * @return An ObjectKey with the value of object at key.     */    public ObjectKey getObjectKey(String name)    {        return (ObjectKey) getCriterion(name).getValue();    }    /**     * Convenience method to return an ObjectKey.     *     * @param table String name of table.     * @param column String name of column.     * @return A String with the value of object at key.     */    public ObjectKey getObjectKey(String table, String column)    {        return getObjectKey(                new StringBuffer(table.length() + column.length() + 1)                .append(table).append('.').append(column)                .toString());    }    /**     * Overrides Hashtable get, so that the value placed in the     * Criterion is returned instead of the Criterion.     *     * @param key An Object.     * @return An Object.     */    public Object get(Object key)    {        return getValue((String) key);    }    /**     * Overrides Hashtable put, so that this object is returned     * instead of the value previously in the Criteria object.     * The reason is so that it more closely matches the behavior     * of the add() methods. If you want to get the previous value     * then you should first Criteria.get() it yourself. Note, if     * you attempt to pass in an Object that is not a String, it will     * throw a NPE. The reason for this is that none of the add()     * methods support adding anything other than a String as a key.     *     * @param key An Object. Must be instanceof String!     * @param value An Object.     * @throws NullPointerException if key != String or key/value is null.     * @return Instance of self.     */    public Object put(Object key, Object value)    {        if (!(key instanceof String))        {            throw new NullPointerException(                    "Criteria: Key must be a String object.");        }        return add((String) key, value);    }    /**     * Copies all of the mappings from the specified Map to this Criteria     * These mappings will replace any mappings that this Criteria had for any     * of the keys currently in the specified Map.     *     * if the map was another Criteria, its attributes are copied to this     * Criteria, overwriting previous settings.     *     * @param t Mappings to be stored in this map.     */    public synchronized void putAll(Map t)    {        Iterator i = t.entrySet().iterator();        while (i.hasNext())        {            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.joins = c.joins;        }        /* 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;

⌨️ 快捷键说明

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