These need to return FunctionExp to be binary compatible. Let this be a

reminder why it can be useful not to return the most specific type possible
from a method, but rather a more general supertype that allows us to change the
internals of the method without losing binary compatibility.
This commit is contained in:
Michael Bayne
2009-09-10 00:52:23 +00:00
parent fce9e56aca
commit 0326468e8e
+8 -10
View File
@@ -21,8 +21,6 @@
package com.samskivert.depot;
import com.samskivert.depot.expression.*;
import com.samskivert.depot.function.AggregateFun;
import com.samskivert.depot.function.NumericalFun;
/**
* Provides static methods for expression construction. For example: {@link #literal}, {@link
@@ -109,18 +107,18 @@ public class Exps
* be used in a FieldOverride and supplied with a ColumnExp.
*/
@Deprecated
public static AggregateFun.Sum sum (SQLExpression expr)
public static FunctionExp sum (SQLExpression expr)
{
return new AggregateFun.Sum(expr);
return new FunctionExp("sum", expr);
}
/**
* Creates an expression that computes the absolute value of the supplied expression.
*/
@Deprecated
public static NumericalFun.Abs abs (SQLExpression expr)
public static FunctionExp abs (SQLExpression expr)
{
return new NumericalFun.Abs(expr);
return new FunctionExp("abs", expr);
}
/**
@@ -128,9 +126,9 @@ public class Exps
* This would usually be used in a FieldOverride and supplied with a ColumnExp.
*/
@Deprecated
public static AggregateFun.Count count (SQLExpression expr)
public static FunctionExp count (SQLExpression expr)
{
return new AggregateFun.Count(expr, false);
return new FunctionExp("count", expr);
}
/**
@@ -138,8 +136,8 @@ public class Exps
* expression. This would usually be used in a FieldOverride and supplied with a ColumnExp.
*/
@Deprecated
public static AggregateFun.Count countDistinct (SQLExpression expr)
public static FunctionExp countDistinct (SQLExpression expr)
{
return new AggregateFun.Count(expr, true);
return new FunctionExp("count", "distinct", expr);
}
}