org.springframework.batch.item.file.transform

## Interface FieldSet

- All Known Implementing Classes:
    DefaultFieldSet

      public interface FieldSet

  Interface used by flat file input sources to encapsulate concerns of converting an array of Strings to Java native types. A bit like the role played by `ResultSet` in JDBC, clients will know the name or position of strongly typed fields that they want to extract.
  Author:
    Dave Syer

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getFieldCount()` Return the number of fields in this '`FieldSet`'.
    `java.lang.String[]` | `getNames()` Accessor for the names of the fields.
    `java.util.Properties` | `getProperties()` Construct name-value pairs from the field names and string values.
    `java.lang.String[]` | `getValues()`
    `boolean` | `hasNames()` Check if there are names defined for the fields.
    `java.math.BigDecimal` | `readBigDecimal(int index)` Read the `BigDecimal` value at index '`index`'.
    `java.math.BigDecimal` | `readBigDecimal(int index, java.math.BigDecimal defaultValue)` Read the `BigDecimal` value at index '`index`', returning the supplied `defaultValue` if the trimmed string value at index '`index`' is blank.
    `java.math.BigDecimal` | `readBigDecimal(java.lang.String name)` Read the `BigDecimal` value from column with given '`name`.
    `java.math.BigDecimal` | `readBigDecimal(java.lang.String name, java.math.BigDecimal defaultValue)` Read the `BigDecimal` value from column with given '`name`, returning the supplied `defaultValue` if the trimmed string value at index '`index`' is blank.
    `boolean` | `readBoolean(int index)` Read the '`boolean`' value at index '`index`'.
    `boolean` | `readBoolean(int index, java.lang.String trueValue)` Read the '`boolean`' value at index '`index`'.
    `boolean` | `readBoolean(java.lang.String name)` Read the '`boolean`' value from column with given '`name`'.
    `boolean` | `readBoolean(java.lang.String name, java.lang.String trueValue)` Read the '`boolean`' value from column with given '`name`'.
    `byte` | `readByte(int index)` Read the '`byte`' value at index '`index`'.
    `byte` | `readByte(java.lang.String name)` Read the '`byte`' value from column with given '`name`'.
    `char` | `readChar(int index)` Read the '`char`' value at index '`index`'.
    `char` | `readChar(java.lang.String name)` Read the '`char`' value from column with given '`name`'.
    `java.util.Date` | `readDate(int index)` Read the `java.util.Date` value in default format at designated column `index`.
    `java.util.Date` | `readDate(int index, java.util.Date defaultValue)` Read the `java.util.Date` value in default format at designated column `index`.
    `java.util.Date` | `readDate(int index, java.lang.String pattern)` Read the `java.util.Date` value in default format at designated column `index`.
    `java.util.Date` | `readDate(int index, java.lang.String pattern, java.util.Date defaultValue)` Read the `java.util.Date` value in default format at designated column `index`.
    `java.util.Date` | `readDate(java.lang.String name)` Read the `java.sql.Date` value in given format from column with given `name`.
    `java.util.Date` | `readDate(java.lang.String name, java.util.Date defaultValue)` Read the `java.sql.Date` value in given format from column with given `name`.
    `java.util.Date` | `readDate(java.lang.String name, java.lang.String pattern)` Read the `java.sql.Date` value in given format from column with given `name`.
    `java.util.Date` | `readDate(java.lang.String name, java.lang.String pattern, java.util.Date defaultValue)` Read the `java.sql.Date` value in given format from column with given `name`.
    `double` | `readDouble(int index)` Read the '`double`' value at index '`index`'.
    `double` | `readDouble(java.lang.String name)` Read the '`double`' value from column with given '`name`.
    `float` | `readFloat(int index)` Read the '`float`' value at index '`index`'.
    `float` | `readFloat(java.lang.String name)` Read the '`float`' value from column with given '`name`.
    `int` | `readInt(int index)` Read the '`int`' value at index '`index`'.
    `int` | `readInt(int index, int defaultValue)` Read the '`int`' value at index '`index`', using the supplied `defaultValue` if the field value is blank.
    `int` | `readInt(java.lang.String name)` Read the '`int`' value from column with given '`name`'.
    `int` | `readInt(java.lang.String name, int defaultValue)` Read the '`int`' value from column with given '`name`', using the supplied `defaultValue` if the field value is blank.
    `long` | `readLong(int index)` Read the '`long`' value at index '`index`'.
    `long` | `readLong(int index, long defaultValue)` Read the '`long`' value at index '`index`', using the supplied `defaultValue` if the field value is blank.
    `long` | `readLong(java.lang.String name)` Read the '`long`' value from column with given '`name`'.
    `long` | `readLong(java.lang.String name, long defaultValue)` Read the '`long`' value from column with given '`name`', using the supplied `defaultValue` if the field value is blank.
    `java.lang.String` | `readRawString(int index)` Read the `String` value at index '`index`' including trailing whitespace (don't trim).
    `java.lang.String` | `readRawString(java.lang.String name)` Read the `String` value from column with given '`name`' including trailing whitespace (don't trim).
    `short` | `readShort(int index)` Read the '`short`' value at index '`index`'.
    `short` | `readShort(java.lang.String name)` Read the '`short`' value from column with given '`name`'.
    `java.lang.String` | `readString(int index)` Read the `String` value at index '`index`'.
    `java.lang.String` | `readString(java.lang.String name)` Read the `String` value from column with given '`name`'.

- - ### Method Detail

    - #### getNames

          java.lang.String[] getNames()

      Accessor for the names of the fields.
      Returns:
        the names
      Throws:
        `java.lang.IllegalStateException` - if the names are not defined

    - #### hasNames

          boolean hasNames()

      Check if there are names defined for the fields.
      Returns:
        true if there are names for the fields

    - #### getValues

          java.lang.String[] getValues()

      Returns:
        fields wrapped by this '`FieldSet`' instance as String values.

    - #### readString

          java.lang.String readString(int index)

      Read the `String` value at index '`index`'.
      Parameters:
        `index` - the field index.
      Throws:
        `java.lang.IndexOutOfBoundsException` - if the index is out of bounds.

    - #### readString

          java.lang.String readString(java.lang.String name)

      Read the `String` value from column with given '`name`'.
      Parameters:
        `name` - the field name.

    - #### readRawString

          java.lang.String readRawString(int index)

      Read the `String` value at index '`index`' including trailing whitespace (don't trim).
      Parameters:
        `index` - the field index.
      Throws:
        `java.lang.IndexOutOfBoundsException` - if the index is out of bounds.

    - #### readRawString

          java.lang.String readRawString(java.lang.String name)

      Read the `String` value from column with given '`name`' including trailing whitespace (don't trim).
      Parameters:
        `name` - the field name.

    - #### readBoolean

          boolean readBoolean(int index)

      Read the '`boolean`' value at index '`index`'.
      Parameters:
        `index` - the field index.
      Throws:
        `java.lang.IndexOutOfBoundsException` - if the index is out of bounds.

    - #### readBoolean

          boolean readBoolean(java.lang.String name)

      Read the '`boolean`' value from column with given '`name`'.
      Parameters:
        `name` - the field name.
      Throws:
        `java.lang.IllegalArgumentException` - if a column with given name is not defined.

    - #### readBoolean

          boolean readBoolean(int index,
                              java.lang.String trueValue)

      Read the '`boolean`' value at index '`index`'.
      Parameters:
        `index` - the field index.
        `trueValue` - the value that signifies `true`; case-sensitive.
      Throws:
        `java.lang.IndexOutOfBoundsException` - if the index is out of bounds, or if the supplied `trueValue` is `null`.

    - #### readBoolean

          boolean readBoolean(java.lang.String name,
                              java.lang.String trueValue)

      Read the '`boolean`' value from column with given '`name`'.
      Parameters:
        `name` - the field name.
        `trueValue` - the value that signifies `true`; case-sensitive.
      Throws:
        `java.lang.IllegalArgumentException` - if a column with given name is not defined, or if the supplied `trueValue` is `null`.

    - #### readChar

          char readChar(int index)

      Read the '`char`' value at index '`index`'.
      Parameters:
        `index` - the field index.
      Throws:
        `java.lang.IndexOutOfBoundsException` - if the index is out of bounds.

    - #### readChar

          char readChar(java.lang.String name)

      Read the '`char`' value from column with given '`name`'.
      Parameters:
        `name` - the field name.
      Throws:
        `java.lang.IllegalArgumentException` - if a column with given name is not defined.

    - #### readByte

          byte readByte(int index)

      Read the '`byte`' value at index '`index`'.
      Parameters:
        `index` - the field index.
      Throws:
        `java.lang.IndexOutOfBoundsException` - if the index is out of bounds.

    - #### readByte

          byte readByte(java.lang.String name)

      Read the '`byte`' value from column with given '`name`'.
      Parameters:
        `name` - the field name.

    - #### readShort

          short readShort(int index)

      Read the '`short`' value at index '`index`'.
      Parameters:
        `index` - the field index.
      Throws:
        `java.lang.IndexOutOfBoundsException` - if the index is out of bounds.

    - #### readShort

          short readShort(java.lang.String name)

      Read the '`short`' value from column with given '`name`'.
      Parameters:
        `name` - the field name.
      Throws:
        `java.lang.IllegalArgumentException` - if a column with given name is not defined.

    - #### readInt

          int readInt(int index)

      Read the '`int`' value at index '`index`'.
      Parameters:
        `index` - the field index.
      Throws:
        `java.lang.IndexOutOfBoundsException` - if the index is out of bounds.

    - #### readInt

          int readInt(java.lang.String name)

      Read the '`int`' value from column with given '`name`'.
      Parameters:
        `name` - the field name.
      Throws:
        `java.lang.IllegalArgumentException` - if a column with given name is not defined.

    - #### readInt

          int readInt(int index,
                      int defaultValue)

      Read the '`int`' value at index '`index`', using the supplied `defaultValue` if the field value is blank.
      Parameters:
        `index` - the field index.
      Throws:
        `java.lang.IndexOutOfBoundsException` - if the index is out of bounds.

    - #### readInt

          int readInt(java.lang.String name,
                      int defaultValue)

      Read the '`int`' value from column with given '`name`', using the supplied `defaultValue` if the field value is blank.
      Parameters:
        `name` - the field name.
      Throws:
        `java.lang.IllegalArgumentException` - if a column with given name is not defined.

    - #### readLong

          long readLong(int index)

      Read the '`long`' value at index '`index`'.
      Parameters:
        `index` - the field index.
      Throws:
        `java.lang.IndexOutOfBoundsException` - if the index is out of bounds.

    - #### readLong

          long readLong(java.lang.String name)

      Read the '`long`' value from column with given '`name`'.
      Parameters:
        `name` - the field name.
      Throws:
        `java.lang.IllegalArgumentException` - if a column with given name is not defined.

    - #### readLong

          long readLong(int index,
                        long defaultValue)

      Read the '`long`' value at index '`index`', using the supplied `defaultValue` if the field value is blank.
      Parameters:
        `index` - the field index.
      Throws:
        `java.lang.IndexOutOfBoundsException` - if the index is out of bounds.

    - #### readLong

          long readLong(java.lang.String name,
                        long defaultValue)

      Read the '`long`' value from column with given '`name`', using the supplied `defaultValue` if the field value is blank.
      Parameters:
        `name` - the field name.
      Throws:
        `java.lang.IllegalArgumentException` - if a column with given name is not defined.

    - #### readFloat

          float readFloat(int index)

      Read the '`float`' value at index '`index`'.
      Parameters:
        `index` - the field index.
      Throws:
        `java.lang.IndexOutOfBoundsException` - if the index is out of bounds.

    - #### readFloat

          float readFloat(java.lang.String name)

      Read the '`float`' value from column with given '`name`.
      Parameters:
        `name` - the field name.
      Throws:
        `java.lang.IllegalArgumentException` - if a column with given name is not defined.

    - #### readDouble

          double readDouble(int index)

      Read the '`double`' value at index '`index`'.
      Parameters:
        `index` - the field index.
      Throws:
        `java.lang.IndexOutOfBoundsException` - if the index is out of bounds.

    - #### readDouble

          double readDouble(java.lang.String name)

      Read the '`double`' value from column with given '`name`.
      Parameters:
        `name` - the field name.
      Throws:
        `java.lang.IllegalArgumentException` - if a column with given name is not defined.

    - #### readBigDecimal

          java.math.BigDecimal readBigDecimal(int index)

      Read the `BigDecimal` value at index '`index`'.
      Parameters:
        `index` - the field index.
      Throws:
        `java.lang.IndexOutOfBoundsException` - if the index is out of bounds.

    - #### readBigDecimal

          java.math.BigDecimal readBigDecimal(java.lang.String name)

      Read the `BigDecimal` value from column with given '`name`.
      Parameters:
        `name` - the field name.
      Throws:
        `java.lang.IllegalArgumentException` - if a column with given name is not defined.

    - #### readBigDecimal

          java.math.BigDecimal readBigDecimal(int index,
                                              java.math.BigDecimal defaultValue)

      Read the `BigDecimal` value at index '`index`', returning the supplied `defaultValue` if the trimmed string value at index '`index`' is blank.
      Parameters:
        `index` - the field index.
      Throws:
        `java.lang.IndexOutOfBoundsException` - if the index is out of bounds.

    - #### readBigDecimal

          java.math.BigDecimal readBigDecimal(java.lang.String name,
                                              java.math.BigDecimal defaultValue)

      Read the `BigDecimal` value from column with given '`name`, returning the supplied `defaultValue` if the trimmed string value at index '`index`' is blank.
      Parameters:
        `name` - the field name.
        `defaultValue` - the default value to use if the field is blank
      Throws:
        `java.lang.IllegalArgumentException` - if a column with given name is not defined.

    - #### readDate

          java.util.Date readDate(int index)

      Read the `java.util.Date` value in default format at designated column `index`.
      Parameters:
        `index` - the field index.
      Throws:
        `java.lang.IndexOutOfBoundsException` - if the index is out of bounds.
        `java.lang.IllegalArgumentException` - if the value is not parseable
        `java.lang.NullPointerException` - if the value is empty

    - #### readDate

          java.util.Date readDate(java.lang.String name)

      Read the `java.sql.Date` value in given format from column with given `name`.
      Parameters:
        `name` - the field name.
      Throws:
        `java.lang.IllegalArgumentException` - if a column with given name is not defined or if the value is not parseable
        `java.lang.NullPointerException` - if the value is empty

    - #### readDate

          java.util.Date readDate(int index,
                                  java.util.Date defaultValue)

      Read the `java.util.Date` value in default format at designated column `index`.
      Parameters:
        `index` - the field index.
        `defaultValue` - the default value to use if the field is blank
      Throws:
        `java.lang.IndexOutOfBoundsException` - if the index is out of bounds.
        `java.lang.IllegalArgumentException` - if the value is not parseable
        `java.lang.NullPointerException` - if the value is empty

    - #### readDate

          java.util.Date readDate(java.lang.String name,
                                  java.util.Date defaultValue)

      Read the `java.sql.Date` value in given format from column with given `name`.
      Parameters:
        `name` - the field name.
        `defaultValue` - the default value to use if the field is blank
      Throws:
        `java.lang.IllegalArgumentException` - if a column with given name is not defined.

    - #### readDate

          java.util.Date readDate(int index,
                                  java.lang.String pattern)

      Read the `java.util.Date` value in default format at designated column `index`.
      Parameters:
        `index` - the field index.
        `pattern` - the pattern describing the date and time format
      Throws:
        `java.lang.IndexOutOfBoundsException` - if the index is out of bounds.
        `java.lang.IllegalArgumentException` - if the date cannot be parsed.

    - #### readDate

          java.util.Date readDate(java.lang.String name,
                                  java.lang.String pattern)

      Read the `java.sql.Date` value in given format from column with given `name`.
      Parameters:
        `name` - the field name.
        `pattern` - the pattern describing the date and time format
      Throws:
        `java.lang.IllegalArgumentException` - if a column with given name is not defined or if the specified field cannot be parsed

    - #### readDate

          java.util.Date readDate(int index,
                                  java.lang.String pattern,
                                  java.util.Date defaultValue)

      Read the `java.util.Date` value in default format at designated column `index`.
      Parameters:
        `index` - the field index.
        `pattern` - the pattern describing the date and time format
        `defaultValue` - the default value to use if the field is blank
      Throws:
        `java.lang.IndexOutOfBoundsException` - if the index is out of bounds.
        `java.lang.IllegalArgumentException` - if the date cannot be parsed.

    - #### readDate

          java.util.Date readDate(java.lang.String name,
                                  java.lang.String pattern,
                                  java.util.Date defaultValue)

      Read the `java.sql.Date` value in given format from column with given `name`.
      Parameters:
        `name` - the field name.
        `pattern` - the pattern describing the date and time format
        `defaultValue` - the default value to use if the field is blank
      Throws:
        `java.lang.IllegalArgumentException` - if a column with given name is not defined or if the specified field cannot be parsed

    - #### getFieldCount

          int getFieldCount()

      Return the number of fields in this '`FieldSet`'.

    - #### getProperties

          java.util.Properties getProperties()

      Construct name-value pairs from the field names and string values. Null values are omitted.
      Returns:
        some properties representing the field set.
      Throws:
        `java.lang.IllegalStateException` - if the field name meta data is not available.