Package org.springframework.batch.item.file.mapping

# Class RecordFieldSetMapper<T>

java.lang.Object
org.springframework.batch.item.file.mapping.RecordFieldSetMapper<T>

Type Parameters:
  `T` - type of mapped items

All Implemented Interfaces:
  `FieldSetMapper<T>`

public class RecordFieldSetMapper<T> extends Object implements FieldSetMapper<T>
This is a `FieldSetMapper` that supports Java records mapping (requires JKD 14 or higher). It uses the record's canonical constructor to map components with the same name as tokens in the `FieldSet`.

Since:
  4.3
Author:
  Mahmoud Ben Hassine

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `RecordFieldSetMapper(Class<T> targetType)`
  Create a new `RecordFieldSetMapper`.
  `RecordFieldSetMapper(Class<T> targetType, org.springframework.core.convert.ConversionService conversionService)`
  Create a new `RecordFieldSetMapper`.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `T`
  `mapFieldSet(FieldSet fieldSet)`
  Method used to map data obtained from a `FieldSet` into an object.

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

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

- ## Constructor Details

  - ### RecordFieldSetMapper

    public RecordFieldSetMapper(Class<T> targetType)
    Create a new `RecordFieldSetMapper`.
    Parameters:
      `targetType` - type of mapped items

  - ### RecordFieldSetMapper

    public RecordFieldSetMapper(Class<T> targetType, org.springframework.core.convert.ConversionService conversionService)
    Create a new `RecordFieldSetMapper`.
    Parameters:
      `targetType` - type of mapped items
      `conversionService` - service to use to convert raw data to typed fields

- ## Method Details

  - ### mapFieldSet

    public T mapFieldSet(FieldSet fieldSet)
    Description copied from interface: `FieldSetMapper`
    Method used to map data obtained from a `FieldSet` into an object.
    Specified by:
      `mapFieldSet` in interface `FieldSetMapper<T>`
    Parameters:
      `fieldSet` - the `FieldSet` to map
    Returns:
      the populated object