public class JobParametersBuilder
extends java.lang.Object
JobParameters
. Useful because all
JobParameter
objects are immutable, and must be instantiated separately
to ensure type safety. 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.JobParameters
,
JobParameter
Constructor and Description |
---|
JobParametersBuilder()
Default constructor.
|
JobParametersBuilder(JobExplorer jobExplorer) |
JobParametersBuilder(JobParameters jobParameters)
Copy constructor.
|
JobParametersBuilder(JobParameters jobParameters,
JobExplorer jobExplorer)
Copy constructor.
|
JobParametersBuilder(java.util.Properties properties)
Constructor to add conversion capabilities to support JSR-352.
|
Modifier and Type | Method and Description |
---|---|
JobParametersBuilder |
addDate(java.lang.String key,
java.util.Date parameter)
Add a new identifying
Date parameter for the given key. |
JobParametersBuilder |
addDate(java.lang.String key,
java.util.Date parameter,
boolean identifying)
Add a new
Date parameter for the given key. |
JobParametersBuilder |
addDouble(java.lang.String key,
java.lang.Double parameter)
Add a new identifying Double parameter for the given key.
|
JobParametersBuilder |
addDouble(java.lang.String key,
java.lang.Double parameter,
boolean identifying)
Add a new Double parameter for the given key.
|
JobParametersBuilder |
addJobParameters(JobParameters jobParameters)
Copy job parameters into the current state.
|
JobParametersBuilder |
addLong(java.lang.String key,
java.lang.Long parameter)
Add a new identifying Long parameter for the given key.
|
JobParametersBuilder |
addLong(java.lang.String key,
java.lang.Long parameter,
boolean identifying)
Add a new Long parameter for the given key.
|
JobParametersBuilder |
addParameter(java.lang.String key,
JobParameter jobParameter)
Add a new
JobParameter for the given key. |
JobParametersBuilder |
addString(java.lang.String key,
java.lang.String parameter)
Add a new identifying String parameter for the given key.
|
JobParametersBuilder |
addString(java.lang.String key,
java.lang.String parameter,
boolean identifying)
Add a new String parameter for the given key.
|
JobParametersBuilder |
getNextJobParameters(Job job)
Initializes the
JobParameters based on the state of the Job . |
JobParameters |
toJobParameters()
Conversion method that takes the current state of this builder and
returns it as a JobParameters object.
|
public JobParametersBuilder()
public JobParametersBuilder(JobExplorer jobExplorer)
jobExplorer
- JobExplorer
used for looking up previous job parameter informationpublic JobParametersBuilder(JobParameters jobParameters)
jobParameters
- JobParameters
instance used to initialize the builder.public JobParametersBuilder(java.util.Properties properties)
Properties
instance are Stringsproperties
- the job parameters to be usedpublic JobParametersBuilder(JobParameters jobParameters, JobExplorer jobExplorer)
jobParameters
- JobParameters
instance used to initialize the builder.jobExplorer
- JobExplorer
used for looking up previous job parameter informationpublic JobParametersBuilder addString(java.lang.String key, java.lang.String parameter)
key
- - parameter accessor.parameter
- - runtime parameterpublic JobParametersBuilder addString(java.lang.String key, java.lang.String parameter, boolean identifying)
key
- - parameter accessor.parameter
- - runtime parameteridentifying
- - indicates if the parameter is used as part of identifying a job instancepublic JobParametersBuilder addDate(java.lang.String key, java.util.Date parameter)
Date
parameter for the given key.key
- - parameter accessor.parameter
- - runtime parameterpublic JobParametersBuilder addDate(java.lang.String key, java.util.Date parameter, boolean identifying)
Date
parameter for the given key.key
- - parameter accessor.parameter
- - runtime parameteridentifying
- - indicates if the parameter is used as part of identifying a job instancepublic JobParametersBuilder addLong(java.lang.String key, java.lang.Long parameter)
key
- - parameter accessor.parameter
- - runtime parameterpublic JobParametersBuilder addLong(java.lang.String key, java.lang.Long parameter, boolean identifying)
key
- - parameter accessor.parameter
- - runtime parameteridentifying
- - indicates if the parameter is used as part of identifying a job instancepublic JobParametersBuilder addDouble(java.lang.String key, java.lang.Double parameter)
key
- - parameter accessor.parameter
- - runtime parameterpublic JobParametersBuilder addDouble(java.lang.String key, java.lang.Double parameter, boolean identifying)
key
- - parameter accessor.parameter
- - runtime parameteridentifying
- - indicates if the parameter is used as part of identifying a job instancepublic JobParameters toJobParameters()
JobParameters
object.public JobParametersBuilder addParameter(java.lang.String key, JobParameter jobParameter)
JobParameter
for the given key.key
- - parameter accessorjobParameter
- - runtime parameterpublic JobParametersBuilder addJobParameters(JobParameters jobParameters)
jobParameters
- parameters to copy inpublic JobParametersBuilder getNextJobParameters(Job job)
JobParameters
based on the state of the Job
. This
should be called after all parameters have been entered into the builder.
All parameters already set on this builder instance will be appended to
those retrieved from the job incrementer, overriding any with the same key (Same
behaviour as CommandLineJobRunner
with "-next" option and JobOperator.startNextInstance(String)
)job
- the job for which the JobParameters
are being constructed.