org.springframework.batch.sample.common

## Class ColumnRangePartitioner

- java.lang.Object
- - org.springframework.batch.sample.common.ColumnRangePartitioner

- All Implemented Interfaces:
    Partitioner

      public class ColumnRangePartitioner
      extends java.lang.Object
      implements Partitioner

  Simple minded partitioner for a range of values of a column in a database table. Works best if the values are uniformly distributed (e.g. auto-generated primary key values).
  Author:
    Dave Syer

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ColumnRangePartitioner()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.Map<java.lang.String,ExecutionContext>` | `partition(int gridSize)` Partition a database table assuming that the data in the column specified are uniformly distributed.
    `void` | `setColumn(java.lang.String column)` The name of the column to partition.
    `void` | `setDataSource(javax.sql.DataSource dataSource)` The data source for connecting to the database.
    `void` | `setTable(java.lang.String table)` The name of the SQL table the data are in.

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

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

- - ### Constructor Detail

    - #### ColumnRangePartitioner

          public ColumnRangePartitioner()

  - ### Method Detail

    - #### setTable

          public void setTable(java.lang.String table)

      The name of the SQL table the data are in.
      Parameters:
        `table` - the name of the table

    - #### setColumn

          public void setColumn(java.lang.String column)

      The name of the column to partition.
      Parameters:
        `column` - the column name.

    - #### setDataSource

          public void setDataSource(javax.sql.DataSource dataSource)

      The data source for connecting to the database.
      Parameters:
        `dataSource` - a `DataSource`

    - #### partition

          public java.util.Map<java.lang.String,ExecutionContext> partition(int gridSize)

      Partition a database table assuming that the data in the column specified are uniformly distributed. The execution context values will have keys `minValue` and `maxValue` specifying the range of values to consider in each partition.
      Specified by:
        `partition` in interface `Partitioner`
      Parameters:
        `gridSize` - the size of the map to return
      Returns:
        a map from identifier to input parameters
      See Also:
        `Partitioner.partition(int)`