Author: tfischer
Date: Sat Jun 9 03:37:58 2012
New Revision: 1348310
URL: http://svn.apache.org/viewvc?rev=1348310&view=rev
Log:
Fix bad cast
Modified:
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/Criteria.java
Modified:
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/Criteria.java
URL:
http://svn.apache.org/viewvc/db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/Criteria.java?rev=1348310&r1=1348309&r2=1348310&view=diff
==============================================================================
---
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/Criteria.java
(original)
+++
db/torque/torque4/trunk/torque-runtime/src/main/java/org/apache/torque/util/Criteria.java
Sat Jun 9 03:37:58 2012
@@ -67,6 +67,7 @@ import org.apache.torque.sql.SqlBuilder;
* Use org.apache.torque.criteria.Criteria instead; note that
* that class has another semantics of the add.. and or.. methods.
*/
+@Deprecated
public class Criteria implements Serializable, CriteriaInterface<Criteria>
{
/** Serial version. */
@@ -151,39 +152,39 @@ public class Criteria implements Seriali
private boolean singleRecord = false;
/** List of modifiers like DISTICT. */
- private UniqueList<String> selectModifiers = new UniqueList<String>();
+ private final UniqueList<String> selectModifiers = new
UniqueList<String>();
/** List of all columns to select. */
- private UniqueColumnList selectColumns = new UniqueColumnList();
+ private final UniqueColumnList selectColumns = new UniqueColumnList();
/** All "order by" clauses, containing the order ASC or DESC. */
- private UniqueList<OrderBy> orderByColumns = new UniqueList<OrderBy>();
+ private final UniqueList<OrderBy> orderByColumns = new
UniqueList<OrderBy>();
/** The names of columns to add to a groupBy clause */
- private UniqueColumnList groupByColumns = new UniqueColumnList();
+ private final UniqueColumnList groupByColumns = new UniqueColumnList();
/** The having clause in a query. */
private Criterion having = null;
/** The criterion objects, keyed by the column. */
- private Map<Column, Criteria.Criterion> criterionMap
+ private final Map<Column, Criteria.Criterion> criterionMap
= new HashMap<Column, Criteria.Criterion>();
/**
* Maps column alias names to the real column names.
* The key of the map is the alias and the value is the real column.
*/
- private Map<String, Column> asColumns
+ private final Map<String, Column> asColumns
= new LinkedHashMap<String, Column>();
/** Contains all joins. */
- private List<Join> joins = new ArrayList<Join>();
+ private final List<Join> joins = new ArrayList<Join>();
/** The name of the database. */
private String dbName;
/** The name of the database as given in the contructor. */
- private String originalDbName;
+ private final String originalDbName;
/**
* To limit the number of rows to return. <code>-1</code> means return all
@@ -198,7 +199,7 @@ public class Criteria implements Seriali
* Aliases for table names. The key of the map is the alias,
* and the value is the real name of the table.
*/
- private Map<String, String> aliases = new HashMap<String, String>();
+ private final Map<String, String> aliases = new HashMap<String, String>();
/** the log. */
private static Log log = LogFactory.getLog(Criteria.class);
@@ -218,6 +219,7 @@ public class Criteria implements Seriali
*
* @deprecated initialCapacity is disregarded
*/
+ @Deprecated
public Criteria(int initialCapacity)
{
this(Torque.getDefaultDB());
@@ -244,6 +246,7 @@ public class Criteria implements Seriali
*
* @deprecated initialCapacity is disregarded
*/
+ @Deprecated
public Criteria(String dbName, int initialCapacity)
{
this.dbName = dbName;
@@ -374,6 +377,7 @@ public class Criteria implements Seriali
* criterion is contained (e.g. if the criterion has been added
* manually with another key).
*/
+ @Deprecated
public boolean containsKey(String table, String column)
{
return containsTopLevelColumn(new ColumnImpl(table, column));
@@ -892,6 +896,7 @@ public class Criteria implements Seriali
*
* @deprecated this method only works if a criterion exists for the key.
*/
+ @Deprecated
public Object get(Column key)
{
return getValue(key);
@@ -914,6 +919,7 @@ public class Criteria implements Seriali
*
* @deprecated this method counts only top-level criterions, not all.
*/
+ @Deprecated
public int size()
{
return criterionMap.size();
@@ -942,6 +948,7 @@ public class Criteria implements Seriali
*
* @deprecated use add(String, Object) instead
*/
+ @Deprecated
public Object put(Column column, Object value)
{
return add(column, value);
@@ -1859,13 +1866,14 @@ public class Criteria implements Seriali
*
* @return A String with the representation of the Criteria.
*/
+ @Override
public String toString()
{
StringBuffer sb = new StringBuffer("Criteria:: ");
Iterator<?> it = keySet().iterator();
while (it.hasNext())
{
- String key = (String) it.next();
+ Object key = it.next();
sb.append(key).append("<=>")
.append(criterionMap.get(key)).append(": ");
}
@@ -1963,6 +1971,7 @@ public class Criteria implements Seriali
*
* @return a hash code value for this object.
*/
+ @Override
public int hashCode()
{
int result = 16;
@@ -2190,6 +2199,7 @@ public class Criteria implements Seriali
*
* @deprecated use and(Column, Object) instead
*/
+ @Deprecated
public Criteria and(String table, String column, Object value)
{
and(table, column, value, EQUAL);
@@ -2220,6 +2230,7 @@ public class Criteria implements Seriali
*
* @deprecated use and(Column, Object, comparison) instead
*/
+ @Deprecated
public Criteria and(String table, String column, Object value,
SqlEnum comparison)
{
@@ -2704,6 +2715,7 @@ public class Criteria implements Seriali
*
* @deprecated use or(Column, Object) instead
*/
+ @Deprecated
public Criteria or(String table, String column, Object value)
{
or(table, column, value, EQUAL);
@@ -2733,6 +2745,7 @@ public class Criteria implements Seriali
*
* @deprecated use or(Column, Object, SqlEnum) instead
*/
+ @Deprecated
public Criteria or(String table, String column, Object value,
SqlEnum comparison)
{
@@ -3058,10 +3071,10 @@ public class Criteria implements Seriali
/**
* other connected criteria.
*/
- private List<Criterion> clauses = new ArrayList<Criterion>();
+ private final List<Criterion> clauses = new ArrayList<Criterion>();
/** The operators (AND, OR...) how the other Criteria are connected. */
- private List<String> conjunctions = new ArrayList<String>();
+ private final List<String> conjunctions = new ArrayList<String>();
/**
* Create a new instance.
@@ -3302,6 +3315,7 @@ public class Criteria implements Seriali
*
* @return A String with the representation of the Criterion.
*/
+ @Override
public String toString()
{
//
@@ -3328,6 +3342,7 @@ public class Criteria implements Seriali
* This method checks another Criteria.Criterion to see if they contain
* the same attributes.
*/
+ @Override
public boolean equals(Object obj)
{
if (this == obj)
@@ -3381,6 +3396,7 @@ public class Criteria implements Seriali
/**
* Returns a hash code value for the object.
*/
+ @Override
public int hashCode()
{
int h = value.hashCode() ^ comparison.hashCode();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]