org.apache.torque.om.mapper

## Class CompositeMapper

- java.lang.Object
- - org.apache.torque.om.mapper.CompositeMapper

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

      public class CompositeMapper
      extends Object
      implements RecordMapper<List<Object>>

  Uses a list of mappers to map a database record to a list of objects.
  Version:
    $Id: CompositeMapper.java 1840416 2018-09-09 15:10:22Z tv $
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `CompositeMapper()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addMapper(RecordMapper<?> mapper, int offset)` Adds a new mapper to be applied to a result set.
    `List<Object>` | `processRow(ResultSet resultSet, int offset, Criteria criteria)` Maps the current row in the result Set by applying all known mappers and putting the result of each mapper in the result list.

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

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

- - ### Constructor Detail

    - #### CompositeMapper

          public CompositeMapper()

  - ### Method Detail

    - #### addMapper

          public void addMapper(RecordMapper<?> mapper,
                                int offset)

      Adds a new mapper to be applied to a result set.
      Parameters:
        `mapper` - the mapper.
        `offset` - the offset of the mapper within this mapper, 0 based.

    - #### processRow

          public List<Object> processRow(ResultSet resultSet,
                                         int offset,
                                         Criteria criteria)
                                  throws TorqueException

      Maps the current row in the result Set by applying all known mappers and putting the result of each mapper in the result list.
      Specified by:
        `processRow` in interface `RecordMapper<List<Object>>`
      Parameters:
        `resultSet` - the result set to map, not null.
        `offset` - the total column 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` - when the mapping fails.

Copyright © 2000–2020 The Apache Software Foundation. All rights reserved.