Package org.apache.torque.util
Class AvgHelper
java.lang.Object
org.apache.torque.util.AvgHelper
Get's the average of a column with entries matching the provided criteria.
This works similarly to the CountHelper when you need to provide
additional selection criteria to compute an average.
For example, limiting the average of a column in a table to a specific user.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the average of a column in a query.avg(Criteria c, Connection conn, String columnName, TableMap tableMap) Returns the average of a column in a query.avg(Criteria c, Connection conn, Column column) Returns the average of a column in a query.Returns the average of a column in a query.
-
Constructor Details
-
AvgHelper
public AvgHelper()
-
-
Method Details
-
avg
Returns the average of a column in a query.- Parameters:
c- Criteria to get the count for.columnName- Name of database Column which is counted. Preferably, use the primary key here.- Returns:
- average of the column matching the query provided
- Throws:
TorqueException- if the query could not be executed
-
avg
Returns the average of a column in a query.- Parameters:
c- Criteria to get the count for.column- Name of database Column which is averaged.- Returns:
- average of the column matching the query provided
- Throws:
TorqueException- if the query could not be executed
-
avg
Returns the average of a column in a query.- Parameters:
c- Criteria to get the count for.conn- Connection to usecolumn- Name of database Column which is averaged.- Returns:
- average of the column matching the query provided
- Throws:
TorqueException- if the query could not be executed
-
avg
public BigDecimal avg(Criteria c, Connection conn, String columnName, TableMap tableMap) throws TorqueException Returns the average of a column in a query.- Parameters:
c- Criteria to get the count for.conn- Connection to usecolumnName- Name of database Column which is averaged.tableMap- the table to count the columns in, or null to determine the table automatically from the criteria.- Returns:
- average of the column matching the query provided
- Throws:
TorqueException- if the query could not be executed.
-