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 of all JobParameters are immutable, and require 3 separate maps of the three supported types to ensure typesafety. Once created, it can be used in the same was a java.lang.StringBuilder (except, order is irrelevant), by adding various parameters types and creating a valid JobRuntimeParametres once finished.

Since:
1.0
Author:
Lucas Ward
See Also:
JobParameters

Constructor Summary
JobParametersBuilder()
          Default 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 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

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 JobRuntimeParameters object.


Copyright © 2009 SpringSource. All Rights Reserved.