Klasse AvgHelper

java.lang.Object
org.apache.torque.util.AvgHelper

public class AvgHelper extends Object
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.
  • Konstruktordetails

    • AvgHelper

      public AvgHelper()
  • Methodendetails

    • avg

      public BigDecimal avg(Criteria c, String columnName) throws TorqueException
      Returns the average of a column in a query.
      Parameter:
      c - Criteria to get the count for.
      columnName - Name of database Column which is counted. Preferably, use the primary key here.
      Gibt zurück:
      average of the column matching the query provided
      Löst aus:
      TorqueException - if the query could not be executed
    • avg

      public BigDecimal avg(Criteria c, Column column) throws TorqueException
      Returns the average of a column in a query.
      Parameter:
      c - Criteria to get the count for.
      column - Name of database Column which is averaged.
      Gibt zurück:
      average of the column matching the query provided
      Löst aus:
      TorqueException - if the query could not be executed
    • avg

      public BigDecimal avg(Criteria c, Connection conn, Column column) throws TorqueException
      Returns the average of a column in a query.
      Parameter:
      c - Criteria to get the count for.
      conn - Connection to use
      column - Name of database Column which is averaged.
      Gibt zurück:
      average of the column matching the query provided
      Löst aus:
      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.
      Parameter:
      c - Criteria to get the count for.
      conn - Connection to use
      columnName - 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.
      Gibt zurück:
      average of the column matching the query provided
      Löst aus:
      TorqueException - if the query could not be executed.