org.springframework.batch.core
Class JobParametersBuilder

java.lang.Object
  extended by org.springframework.batch.core.JobParametersBuilder

public class JobParametersBuilder
extends Object

Helper class for creating JobParameters. Useful because all JobParameter objects are immutable, and must be instantiated separately to ensure typesafety. Once created, it can be used in the same was a java.lang.StringBuilder (except, order is irrelevant), by adding various parameter types and creating a valid JobParameters once finished.

Since:
1.0
Author:
Lucas Ward
See Also:
JobParameters, JobParameter

Constructor Summary
JobParametersBuilder()
          Default constructor.
JobParametersBuilder(JobParameters jobParameters)
          Copy constructor.
 
Method Summary
 JobParametersBuilder addDate(String key, Date parameter)
          Add a new Date parameter for the given key.
 JobParametersBuilder addDouble(String key, Double parameter)
          Add a new Double parameter for the given key.
 JobParametersBuilder addLong(String key, Long parameter)
          Add a new Long parameter for the given key.
 JobParametersBuilder addParameter(String key, JobParameter jobParameter)
          Add a new JobParameter for the given key.
 JobParametersBuilder addString(String key, String parameter)
          Add a new String parameter for the given key.
 JobParameters toJobParameters()
          Conversion method that takes the current state of this builder and returns it as a JobruntimeParameters object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JobParametersBuilder

public JobParametersBuilder()
Default constructor. Initializes the builder with empty parameters.


JobParametersBuilder

public JobParametersBuilder(JobParameters jobParameters)
Copy constructor. Initializes the builder with the supplied parameters.

Method Detail

addString

public JobParametersBuilder addString(String key,
                                      String parameter)
Add a new String parameter for the given key.

Parameters:
key - - parameter accessor.
parameter - - runtime parameter
Returns:
a refernece to this object.

addDate

public JobParametersBuilder addDate(String key,
                                    Date parameter)
Add a new Date parameter for the given key.

Parameters:
key - - parameter accessor.
parameter - - runtime parameter
Returns:
a refernece to this object.

addLong

public JobParametersBuilder addLong(String key,
                                    Long parameter)
Add a new Long parameter for the given key.

Parameters:
key - - parameter accessor.
parameter - - runtime parameter
Returns:
a reference to this object.

addDouble

public JobParametersBuilder addDouble(String key,
                                      Double parameter)
Add a new Double parameter for the given key.

Parameters:
key - - parameter accessor.
parameter - - runtime parameter
Returns:
a reference to this object.

toJobParameters

public JobParameters toJobParameters()
Conversion method that takes the current state of this builder and returns it as a JobruntimeParameters object.

Returns:
a valid JobParameters object.

addParameter

public JobParametersBuilder addParameter(String key,
                                         JobParameter jobParameter)
Add a new JobParameter for the given key.

Parameters:
key - - parameter accessor
jobParameter - - runtime parameter
Returns:
a reference to this object.


Copyright © 2013 SpringSource. All Rights Reserved.