Example usage for org.springframework.batch.core JobParametersBuilder toString

List of usage examples for org.springframework.batch.core JobParametersBuilder toString

Introduction

In this page you can find the example usage for org.springframework.batch.core JobParametersBuilder toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:io.spring.batch.integration.TweetToJobTransformer.java

@Transformer(inputChannel = "jobTweets", outputChannel = "jobChannel")
public JobLaunchRequest transform(Tweet tweet) {

    System.out.println("Creating request");

    String[] tweetParams = tweet.getText().split(" ");
    Job job = (Job) context.getBean(tweetParams[0]);

    System.out.println("Job = " + job.getName());

    JobParametersBuilder paramsBuilder = new JobParametersBuilder();

    for (int i = 1; i < tweetParams.length; i++) {
        String[] param = tweetParams[1].split("=");
        paramsBuilder.addString(param[0], param[1]);
    }//from   www .  jav  a2s  . c o m

    System.out.println("Parameters = " + paramsBuilder.toString());

    JobLaunchRequest request = new JobLaunchRequest(job, paramsBuilder.toJobParameters());

    return request;
}