Package org.apache.torque.om.mapper

# Class ObjectListMapper

java.lang.Object
org.apache.torque.om.mapper.ObjectListMapper

All Implemented Interfaces:
  `Serializable`, `RecordMapper<List<Object>>`

public class ObjectListMapper extends Object implements RecordMapper<List<Object>>
Maps a record to a list of objects. Either the database driver decides which object type is appropriate for each column, or a list of classes can be defined.

Version:
  $Id: ObjectListMapper.java 1840416 2018-09-09 15:10:22Z tv $
See Also:
  - Serialized Form

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ObjectListMapper()`
  Constructor.
  `ObjectListMapper(int numberOfColumnsToMap)`
  Constructor which sets the number of columns to map.
  `ObjectListMapper(List<Class<?>> convertClasses)`
  Constructor which determines the number of columns to map and the classes the result columns are mapped to.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List<Object>`
  `processRow(ResultSet resultSet, int offset, Criteria criteria)`
  Maps the current row in the result set by reading all columns from offset on to the end of the row and store an object for each column in the result.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ObjectListMapper

    public ObjectListMapper()
    Constructor. Determines the number of columns to map from the result set's metadata (this may issue additional database queries). The classes the result columns are mapped to are determined by the database driver.

  - ### ObjectListMapper

    public ObjectListMapper(int numberOfColumnsToMap)
    Constructor which sets the number of columns to map. The classes the result columns are mapped to are determined by the database driver.
    Parameters:
      `numberOfColumnsToMap` - how many columns should be mapped, or -1 to determine the number of columns to map from the result set's metadata (this may issue additional database queries).

  - ### ObjectListMapper

    public ObjectListMapper(List<Class<?>> convertClasses)
    Constructor which determines the number of columns to map and the classes the result columns are mapped to.
    Parameters:
      `convertClasses` - the classes to which the columns should be mapped. The first column is mapped to the first class in the list and so on. May be null, in which case the number of columns to map and the mapped to classes are determined by the database driver. Known classes are: java.lang.reflect.Array, java.math.BigDecimal, java.io.InputStream, java.sql. Blob, Boolean, Byte, byte[], java.io.Reader, java.sql.Clob, java.sql.Date, Double, Float, Integer, Long, Object (i.e. let the database driver decide which class is returned), java.sql.Ref, Short, String, java.sql.Time, java.sql.Timestamp and java.net.URL.

- ## Method Details

  - ### processRow

    public List<Object> processRow(ResultSet resultSet, int offset, Criteria criteria) throws TorqueException
    Maps the current row in the result set by reading all columns from offset on to the end of the row and store an object for each column in the result.
    Specified by:
      `processRow` in interface `RecordMapper<List<Object>>`
    Parameters:
      `resultSet` - the result set to map, not null.
      `offset` - the offset of this mapper within the result set.
      `criteria` - The criteria which created the result set, or null if not known. This parameter is not used by this record mapper.
    Returns:
      a list of mapped objects in the same order as the mappers were ordered, not null.
    Throws:
      `TorqueException` - if retrieving column values from the result set fails or if the number of available columns cannot be determined from the result set.