Class JsonJobParametersConverter

java.lang.Object
org.springframework.batch.core.converter.DefaultJobParametersConverter
org.springframework.batch.core.converter.JsonJobParametersConverter
All Implemented Interfaces:
JobParametersConverter

public class JsonJobParametersConverter extends DefaultJobParametersConverter
Converter for JobParameters instances that uses a JSON naming convention for converting job parameters. The expected notation is the following:

key='{"value": "parameterStringLiteralValue", "type":"fully.qualified.name.of.the.parameter.Type", "identifying": "booleanValue"}'

where:

  • value: string literal representing the value
  • type (optional): fully qualified name of the type of the value. Defaults to String.
  • identifying (optional): boolean to flag the job parameter as identifying or not. Defaults to true
For example, schedule.date={"value": "2022-12-12", "type":"java.time.LocalDate", "identifying": "false"} will be converted to a non identifying job parameter of type LocalDate with value "2022-12-12".

The literal values are converted to the correct type by using the default Spring conversion service, augmented if necessary by any custom converters. The conversion service should be configured with a converter to and from string literals to job parameter types.

By default, the Spring conversion service is augmented to support the conversion of the following types:

Since:
5.0
Author:
Mahmoud Ben Hassine