SyntaxHighlighter

Friday, April 5, 2013

Spring Batch Tip - Convert JobParameters to Map

Spring Batch Tip - Convert JobParameters to Map



if you want to 'flatten' the JobParameters into a simple Map (say, for logging purposes) there's always apache commons collections.

here's the code

    Map convertedParameters = MapUtils.transformedMap(jobParameters.getParameters(),TransformerUtils.nopTransformer(),TransformerUtils.stringValueTransformer());

and here's the pom reference

   
    commons-collections
    commons-collections
    3.2.1
   

No comments:

Post a Comment